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

Function CL_DisconnectPacket

code/client/cl_main.cpp:536–555  ·  view source on GitHub ↗

=================== CL_DisconnectPacket Sometimes the server can drop the client and the netchan based disconnect can be lost. If the client continues to send packets to the server, the server will send out of band disconnect packets to the client so it doesn't have to wait for the full timeout period. =================== */

Source from the content-addressed store, hash-verified

534===================
535*/
536void CL_DisconnectPacket( netadr_t from ) {
537 if ( cls.state != CA_ACTIVE ) {
538 return;
539 }
540
541 // if not from our server, ignore it
542 if ( !NET_CompareAdr( from, clc.netchan.remoteAddress ) ) {
543 return;
544 }
545
546 // if we have received packets within three seconds, ignore it
547 // (it might be a malicious spoof)
548 if ( cls.realtime - clc.lastPacketTime < 3000 ) {
549 return;
550 }
551
552 // drop the connection (FIXME: connection dropped dialog)
553 Com_Printf( "Server disconnected for unknown reason\n" );
554 CL_Disconnect();
555}
556
557
558/*

Callers 1

CL_ConnectionlessPacketFunction · 0.70

Calls 3

CL_DisconnectFunction · 0.70
NET_CompareAdrFunction · 0.50
Com_PrintfFunction · 0.50

Tested by

no test coverage detected