================== idAsyncServer::SendPingToClient ================== */
| 1074 | ================== |
| 1075 | */ |
| 1076 | bool 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 | ================== |
nothing calls this directly
no test coverage detected