MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CL_PacketEvent

Function CL_PacketEvent

code/client/cl_main.cpp:653–686  ·  view source on GitHub ↗

================= CL_PacketEvent A packet has arrived from the main event loop ================= */

Source from the content-addressed store, hash-verified

651=================
652*/
653void CL_PacketEvent( netadr_t from, msg_t *msg ) {
654 clc.lastPacketTime = cls.realtime;
655
656 if ( msg->cursize >= 4 && *(int *)msg->data == -1 ) {
657 CL_ConnectionlessPacket( from, msg );
658 return;
659 }
660
661 if ( cls.state < CA_CONNECTED ) {
662 return; // can't be a valid sequenced packet
663 }
664
665 if ( msg->cursize < 8 ) {
666 Com_Printf ("%s: Runt packet\n",NET_AdrToString( from ));
667 return;
668 }
669
670 //
671 // packet from server
672 //
673 if ( !NET_CompareAdr( from, clc.netchan.remoteAddress ) ) {
674 Com_DPrintf ("%s:sequenced packet without connection\n"
675 ,NET_AdrToString( from ) );
676 // FIXME: send a client disconnect?
677 return;
678 }
679
680 if (!Netchan_Process( &clc.netchan, msg) ) {
681 return; // out of order, duplicated, etc
682 }
683
684 clc.lastPacketTime = cls.realtime;
685 CL_ParseServerMessage( msg );
686}
687
688/*
689==================

Callers 1

Com_EventLoopFunction · 0.50

Calls 7

CL_ConnectionlessPacketFunction · 0.70
CL_ParseServerMessageFunction · 0.70
Com_PrintfFunction · 0.50
NET_AdrToStringFunction · 0.50
NET_CompareAdrFunction · 0.50
Com_DPrintfFunction · 0.50
Netchan_ProcessFunction · 0.50

Tested by

no test coverage detected