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

Function processPingsAndQueries

Engine/source/app/net/serverQuery.cpp:1241–1368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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