| 1091 | //----------------------------------------------------------------------------- |
| 1092 | |
| 1093 | static void processPingsAndQueries( U32 session, bool schedule ) |
| 1094 | { |
| 1095 | if( session != gPingSession ) |
| 1096 | return; |
| 1097 | |
| 1098 | U32 i = 0; |
| 1099 | U32 time = Platform::getVirtualMilliseconds(); |
| 1100 | char addressString[256]; |
| 1101 | U8 flags = ServerFilter::OnlineQuery; |
| 1102 | bool waitingForMaster = ( sActiveFilter.type == ServerFilter::Normal ) && !gGotFirstListPacket && sgServerQueryActive; |
| 1103 | |
| 1104 | for ( i = 0; i < (U32)gPingList.size() && i < (U32)gMaxConcurrentPings; ) |
| 1105 | { |
| 1106 | Ping &p = gPingList[i]; |
| 1107 | |
| 1108 | if ( p.time + gPingTimeout < time ) |
| 1109 | { |
| 1110 | if ( !p.tryCount ) |
| 1111 | { |
| 1112 | // it's timed out. |
| 1113 | if (!p.broadcast) |
| 1114 | { |
| 1115 | Net::addressToString( &p.address, addressString ); |
| 1116 | Con::printf( "Ping to server %s timed out.", addressString ); |
| 1117 | } |
| 1118 | |
| 1119 | // If server info is in list (favorite), set its status: |
| 1120 | ServerInfo* si = findServerInfo( &p.address ); |
| 1121 | if ( si ) |
| 1122 | { |
| 1123 | si->status = ServerInfo::Status_TimedOut; |
| 1124 | gServerBrowserDirty = true; |
| 1125 | } |
| 1126 | |
| 1127 | gFinishedList.push_back( p.address ); |
| 1128 | gPingList.erase( i ); |
| 1129 | |
| 1130 | if ( !waitingForMaster ) |
| 1131 | updatePingProgress(); |
| 1132 | } |
| 1133 | else |
| 1134 | { |
| 1135 | p.tryCount--; |
| 1136 | p.time = time; |
| 1137 | p.key = gKey++; |
| 1138 | |
| 1139 | Net::addressToString( &p.address, addressString ); |
| 1140 | |
| 1141 | if (p.broadcast) |
| 1142 | Con::printf( "LAN server ping: %s...", addressString ); |
| 1143 | else |
| 1144 | Con::printf( "Pinging Server %s (%d)...", addressString, p.tryCount ); |
| 1145 | sendPacket( NetInterface::GamePingRequest, &p.address, p.key, p.session, flags ); |
| 1146 | i++; |
| 1147 | } |
| 1148 | } |
| 1149 | else |
| 1150 | i++; |
no test coverage detected