|
楼主 |
发表于 2007-12-18 23:43:51
|
显示全部楼层
这是我的实现代码:
1〉dll对外提供的接口函数代码- int __stdcall DisConnect( long nConn )
- {
- if( !find_connection(nConn) )return 0; //确认是否存在连接
- Connector *connector_=(Connector *)nConn; //转换为指针
- connector_->reactor()->remove_handler(connector_->get_handle(),
- ACE_Event_Handler::ALL_EVENTS_MASK);
- return 0;
- }
- 2〉ACE_Event_Handler::handle_close代码
- int Connector::handle_close (ACE_HANDLE h, ACE_Reactor_Mask mask)
- {
- ACE_DEBUG((LM_DEBUG, "[Connector::handle_close]handle_close\n"));
- if(mask == ACE_Event_Handler::WRITE_MASK)
- return 0;
- ::SendMessage(m_hPeerWnd, MSG_CONN_BROKEN, 0, (LPARAM)this); //通知应用层断开连接
- mask = ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL;
- //
- //this->reactor()->remove_handler(this, mask);
- this->sock_.close(); //客户端的ACE_SOCK_Stream
- delete this;
- delete_connection((long)this); //从连接列表中删除
- return 0;//ACE_Event_Handler::handle_close(h, mask);
- }
复制代码 上述代码在断开连接时严重崩溃,实在不晓得怎么回事? |
|