| 1236 | //----------------------------------------------------------------------------- |
| 1237 | |
| 1238 | static void processPingsAndQueries( U32 session, bool schedule ) |
| 1239 | { |
| 1240 | if( session != gPingSession ) |
| 1241 | return; |
| 1242 | |
| 1243 | U32 i = 0; |
| 1244 | U32 time = Platform::getVirtualMilliseconds(); |
| 1245 | char addressString[256]; |
| 1246 | U8 flags = ServerFilter::OnlineQuery; |
| 1247 | bool waitingForMaster = ( sActiveFilter.type == ServerFilter::Normal ) && !gGotFirstListPacket && sgServerQueryActive; |
| 1248 | |
| 1249 | for ( i = 0; i < gPingList.size() && i < gMaxConcurrentPings; ) |
| 1250 | { |
| 1251 | Ping &p = gPingList[i]; |
| 1252 | |
| 1253 | if ( p.time + gPingTimeout < time ) |
| 1254 | { |
| 1255 | if ( !p.tryCount ) |
| 1256 | { |
| 1257 | // it's timed out. |
| 1258 | if (!p.broadcast) |
| 1259 | { |
| 1260 | Net::addressToString( &p.address, addressString ); |
| 1261 | Con::printf( "Ping to server %s timed out.", addressString ); |
| 1262 | } |
| 1263 | |
| 1264 | // If server info is in list (favorite), set its status: |
| 1265 | ServerInfo* si = findServerInfo( &p.address ); |
| 1266 | if ( si ) |
| 1267 | { |
| 1268 | si->status = ServerInfo::Status_TimedOut; |
| 1269 | gServerBrowserDirty = true; |
| 1270 | } |
| 1271 | |
| 1272 | gFinishedList.push_back( p.address ); |
| 1273 | gPingList.erase( i ); |
| 1274 | |
| 1275 | if ( !waitingForMaster ) |
| 1276 | updatePingProgress(); |
| 1277 | } |
| 1278 | else |
| 1279 | { |
| 1280 | p.tryCount--; |
| 1281 | p.time = time; |
| 1282 | p.key = gKey++; |
| 1283 | |
| 1284 | Net::addressToString( &p.address, addressString ); |
| 1285 | |
| 1286 | if (p.broadcast) |
| 1287 | Con::printf( "LAN server ping: %s...", addressString ); |
| 1288 | else |
| 1289 | Con::printf( "Pinging Server %s (%d)...", addressString, p.tryCount ); |
| 1290 | sendPacket( NetInterface::GamePingRequest, &p.address, p.key, p.session, flags ); |
| 1291 | i++; |
| 1292 | } |
| 1293 | } |
| 1294 | else |
| 1295 | i++; |
no test coverage detected