void CInputProcessor::Handshake(LPDESC d, const char * c_pData) { TPacketCGHandshake * p = (TPacketCGHandshake *) c_pData; if (d->GetHandshake() != p->dwHandshake) { sys_err("Invalid Handshake on %d", d->GetSocket()); d->SetPhase(PHASE_CLOSE); } else { if (d->IsPhase(PHASE_HANDSHAKE)) { if (d->HandshakeProcess(p->dwTime, p->lDelta, false)) { #ifdef _IMPROVED_PACKET_ENCRYPTION_ d->SendKeyAgreement(); #else if (g_bAuthServer) d->SetPhase(PHASE_AUTH); else d->SetPhase(PHASE_LOGIN); #endif // #ifdef _IMPROVED_PACKET_ENCRYPTION_ } } else d->HandshakeProcess(p->dwTime, p->lDelta, true); } }
void DESC_MANAGER::DestroyDesc(LPDESC d, bool bEraseFromSet) { if (bEraseFromSet) m_set_pkDesc.erase(d); if (d->GetHandshake()) m_map_handshake.erase(d->GetHandshake()); if (d->GetHandle() != 0) m_map_handle.erase(d->GetHandle()); else m_set_pkClientDesc.erase((LPCLIENT_DESC) d); // Explicit call to the virtual function Destroy() d->Destroy(); M2_DELETE(d); --m_iSocketsConnected; }
void CInputUDP::Handshake(LPDESC pDesc, const char * c_pData) { TPacketCGHandshake * pInfo = (TPacketCGHandshake *) c_pData; if (pDesc->GetHandshake() == pInfo->dwHandshake) { sys_log(0, "UDP: Grant %s:%d", inet_ntoa(m_SockAddr.sin_addr), m_SockAddr.sin_port); pDesc->UDPGrant(m_SockAddr); return; } else sys_log(0, "UDP: Handshake differs %s", pDesc->GetHostName()); }