MCPcopy Create free account
hub / github.com/amule-project/amule / PacketReceived

Method PacketReceived

src/ServerSocket.cpp:627–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625
626
627bool CServerSocket::PacketReceived(CPacket* packet)
628{
629 AddDebugLogLineN(logServer, CFormat("Server: Packet Received: Prot %x, Opcode %x, Length %u") % packet->GetProtocol() % packet->GetOpCode() % packet->GetPacketSize());
630
631 if (packet->GetProtocol() == OP_PACKEDPROT) {
632 if (!packet->UnPackPacket(250000)){
633 AddDebugLogLineN(logZLib, CFormat("Failed to decompress server TCP packet: protocol=0x%02x opcode=0x%02x size=%u")
634 % packet->GetProtocol() % packet->GetOpCode() % packet->GetPacketSize());
635 theStats::AddDownOverheadServer(packet->GetPacketSize());
636 return true;
637 }
638
639 packet->SetProtocol(OP_EDONKEYPROT);
640 }
641
642 if (packet->GetProtocol() == OP_EDONKEYPROT) {
643 ProcessPacket(packet->GetDataBuffer(), packet->GetPacketSize(), packet->GetOpCode());
644 } else {
645 AddDebugLogLineN(logServer, CFormat("Received server TCP packet with unknown protocol: protocol=0x%02x opcode=0x%02x size=%u")
646 % packet->GetProtocol() % packet->GetOpCode() % packet->GetPacketSize());
647 theStats::AddDownOverheadServer(packet->GetPacketSize());
648 }
649
650 return true;
651}
652
653
654void CServerSocket::OnClose(int WXUNUSED(nErrorCode))

Callers

nothing calls this directly

Calls 7

CFormatClass · 0.85
GetProtocolMethod · 0.80
GetPacketSizeMethod · 0.80
UnPackPacketMethod · 0.80
SetProtocolMethod · 0.80
GetDataBufferMethod · 0.80
GetOpCodeMethod · 0.45

Tested by

no test coverage detected