MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / processPingsAndQueries

Function processPingsAndQueries

Engine/source/app/net/serverQuery.cpp:1238–1365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1236//-----------------------------------------------------------------------------
1237
1238static 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++;

Callers 5

processMethod · 0.85
queryLanServersFunction · 0.85
queryFavoriteServersFunction · 0.85
querySingleServerFunction · 0.85
processServerListPacketsFunction · 0.85

Calls 14

printfFunction · 0.85
findServerInfoFunction · 0.85
updatePingProgressFunction · 0.85
sendPacketFunction · 0.85
getRootGroupFunction · 0.85
getTargetTimeFunction · 0.85
dStrcpyFunction · 0.85
dSprintfFunction · 0.85
executefFunction · 0.85
isQueryingMethod · 0.80
postEventFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected