|
ACE_Connector<BillingHandler, ACE_SOCK_CONNECTOR> m_Connector;重连部分代码:
-
- BillingHandler* pHandler = this;
- nRet = m_Connector.connect(pHandler, m_SvrAddr, ACE_Synch_Options::asynch);
- if(nRet==-1)
- {
- int nErrno = errno;
- if(nErrno != EWOULDBLOCK)
- //nErrno总是返回10038
- ...........
- }
- 连接关闭的处理:
- int BillingHandler::handle_close(ACE_HANDLE, ACE_Reactor_Mask)
- {
- ACE_Reactor::instance()->remove_handler(this, ACE_Event_Handler::ALL_EVENTS_MASK|ACE_Event_Handler::DONT_CALL);
- if(get_handle() != ACE_INVALID_HANDLE)
- {
- m_Peer.close();
- m_Connector.cancel(this);
- }
- ...
- }
复制代码 连接完成时的处理:-
- int BillingHandler::open(void*)
- {
- m_Peer = peer();
- if(m_Peer.enable(ACE_NONBLOCK) == -1)
- {
- ACE_ERROR_RETURN((LM_ERROR, "(%t) %p\n", "enable"), -1);
- }
-
- if(ACE_Reactor::instance()->->register_handler(this, ACE_Event_Handler::READ_MASK) == -1)
- {
- ACE_ERROR_RETURN((LM_ERROR,"(%t) %p\n","register_handler"), -1);
- }
- return 0;
- }
复制代码 重连时nErrno总是返回10038, 问题出在哪里呢?或者handle_close处理不当? |
|