bool ICharISC::run() { FDASSERT(m_connection.Connector); //check if connector is connected if (!m_connection.Connector->isConnected()) { //inform the user if (m_connection.NextConnect == 0) { Log::write(LOG_ISC, "Lost the connection to the login server!"); m_connection.NextConnect = CTime::seconds() + 3; } //time to reconnect if (CTime::seconds() > m_connection.NextConnect) { //connect if (m_connection.Connector->connect(m_settings->Host.c_str(), m_settings->Port) && //send authentication m_connection.Connector->send(IISCPacketCreator::auth(ISC_CLIENT_CLUSTER, m_settings->Password.c_str(), m_settings->Name.c_str(), m_settings->ThisIP.c_str(), m_settings->ExternalId, 0))) { m_connection.IsWaitingForAuthAnswer = true; m_connection.NextConnect = 0; } //error else { Log::write(LOG_ERROR, "Could not connect to the login server!"); m_connection.NextConnect = CTime::seconds() + 3; } } } //is connected and new data else if (m_connection.Connector->isNew()) { while (_handlePacket(m_connection.Connector)); m_connection.Connector->incoming().clear(); } return true; }
int Connection::doRouting() { Packet* it; int i = 0; while(!inMessages.empty()) { it = inMessages.front(); if(_handlePacket(it, this)) i++; inMessages.pop_front(); delete it; } return i; }
void AccountHandler::handleMessage(Packet* pPacket, BuddyPtr pBuddy) { UT_return_if_fail(pPacket); UT_return_if_fail(pBuddy); AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager(); UT_return_if_fail(pManager); // // handle the incoming packet: first check for a protocol error, then ask the // session manager to handle it, then try to handle it ourselves // if (_handleProtocolError(pPacket, pBuddy) || pManager->processPacket(*this, pPacket, pBuddy)) { DELETEP(pPacket); return; } // it seems we need to handle the packet ourselves _handlePacket(pPacket, pBuddy); DELETEP(pPacket); }