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

Function processPingsAndQueries

engine/source/network/serverQuery.cc:1093–1220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1091//-----------------------------------------------------------------------------
1092
1093static 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++;

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
executefFunction · 0.85
isQueryingMethod · 0.80
postEventFunction · 0.50
dStrcpyFunction · 0.50
dSprintfFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected