ACE NPV2 C++NPv2_Select_Reactor_Log_Server 和Qt 结合问题
用C++npv2Select_Reactor_Log_Server 改写的例子class Logging_Event_Handler :public QObject,public ACE_Event_Handler
{
Q_OBJECT
protected:
// File where log records are written.
ACE_FILE_IO log_file_,data_file_,para_file_;
ACE_FILE_Connector connector_data,connector_para,connector_log;
// Connection to remote peer.
Logging_Handler logging_handler_;
QTimer* _timer_checkdb;
QTimer* _timer_dealdata;
otl_connect db_handle_; /*数据库句柄*/
string connStr_; /*数据库连接串*/
bool wr_fileflag;
typedef ACE_Message_Queue<ACE_NULL_SYNCH>ACEMESQUE;
ACEMESQUE*msg_queue_;
ACE_Message_Block *data_block_;
public:
// Initialize the base class and logging handler.
Logging_Event_Handler (ACE_Reactor *reactor)
: ACE_Event_Handler (reactor),
logging_handler_ (log_file_) {
connStr_=dbconnStr_;
_timer_checkdb=newQTimer(this);
_timer_dealdata=newQTimer(this);
wr_fileflag=0;
msg_queue_=new ACEMESQUE;
};
问题是在每个新链接到来的时候都会重新执行构造函数!
open代码:
if (!connect(_timer_checkdb, SIGNAL(timeout()), this, SLOT(On_timer_checkdb())))
ACE_ERROR_RETURN((LM_ERROR,ACE_TEXT("定时器错误")),-1);
if(!connect(_timer_dealda
页:
[1]