void SocketInitiator::onDisconnect( SocketConnector&, int s ) { QF_STACK_PUSH(SocketInitiator::onDisconnect) SocketConnections::iterator i = m_connections.find( s ); SocketConnections::iterator j = m_pendingConnections.find( s ); SocketConnection* pSocketConnection = 0; if( i != m_connections.end() ) pSocketConnection = i->second; if( j != m_pendingConnections.end() ) pSocketConnection = j->second; if( !pSocketConnection ) return; setDisconnected( pSocketConnection->getSession()->getSessionID() ); Session* pSession = pSocketConnection->getSession(); if ( pSession ) { pSession->disconnect(); setDisconnected( pSession->getSessionID() ); } delete pSocketConnection; m_connections.erase( s ); m_pendingConnections.erase( s ); QF_STACK_POP }
void SocketAcceptor::onDisconnect( SocketServer&, socket_handle s ) { SocketConnections::iterator i = m_connections.find( s ); if ( i == m_connections.end() ) return ; SocketConnection* pSocketConnection = i->second; Session* pSession = pSocketConnection->getSession(); if ( pSession ) pSession->disconnect(); delete pSocketConnection; m_connections.erase( s ); }
void SocketInitiator::onConnect( SocketConnector&, int s ) { QF_STACK_PUSH(SocketInitiator::onConnect) SocketConnections::iterator i = m_pendingConnections.find( s ); if( i == m_pendingConnections.end() ) return; SocketConnection* pSocketConnection = i->second; m_connections[s] = pSocketConnection; m_pendingConnections.erase( i ); setConnected( pSocketConnection->getSession()->getSessionID() ); pSocketConnection->onTimeout(); QF_STACK_POP }