MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / SendPingToClient

Method SendPingToClient

neo/framework/async/AsyncServer.cpp:1076–1104  ·  view source on GitHub ↗

================== idAsyncServer::SendPingToClient ================== */

Source from the content-addressed store, hash-verified

1074==================
1075*/
1076bool idAsyncServer::SendPingToClient( int clientNum ) {
1077 idBitMsg msg;
1078 byte msgBuf[MAX_MESSAGE_SIZE];
1079
1080 serverClient_t &client = clients[clientNum];
1081
1082 if ( client.lastPingTime > realTime ) {
1083 client.lastPingTime = realTime;
1084 }
1085
1086 if ( realTime - client.lastPingTime < PING_RESEND_TIME ) {
1087 return false;
1088 }
1089
1090 if ( idAsyncNetwork::verbose.GetInteger() == 2 ) {
1091 common->Printf( "pinging client %d: gameInitId = %d, gameFrame = %d, gameTime = %d\n", clientNum, gameInitId, gameFrame, gameTime );
1092 }
1093
1094 msg.Init( msgBuf, sizeof( msgBuf ) );
1095 msg.WriteInt( gameInitId );
1096 msg.WriteByte( SERVER_UNRELIABLE_MESSAGE_PING );
1097 msg.WriteInt( realTime );
1098
1099 client.channel.SendMessage( serverPort, serverTime, msg );
1100
1101 client.lastPingTime = realTime;
1102
1103 return true;
1104}
1105
1106/*
1107==================

Callers

nothing calls this directly

Calls 6

GetIntegerMethod · 0.80
PrintfMethod · 0.45
InitMethod · 0.45
WriteIntMethod · 0.45
WriteByteMethod · 0.45
SendMessageMethod · 0.45

Tested by

no test coverage detected