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

Function processServerListPackets

Engine/source/app/net/serverQuery.cpp:1369–1434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1367//-----------------------------------------------------------------------------
1368
1369static void processServerListPackets( U32 session )
1370{
1371 if ( session != gPingSession || !sgServerQueryActive )
1372 return;
1373
1374 U32 currentTime = Platform::getVirtualMilliseconds();
1375
1376 // Loop through the packet status list and resend packet requests where necessary:
1377 for ( U32 i = 0; i < gPacketStatusList.size(); i++ )
1378 {
1379 PacketStatus &p = gPacketStatusList[i];
1380 if ( p.time + gPacketTimeout < currentTime )
1381 {
1382 if ( !p.tryCount )
1383 {
1384 // Packet timed out :(
1385 Con::printf( "Server list packet #%d timed out.", p.getIndex() + 1 );
1386 gPacketStatusList.erase( i );
1387 }
1388 else
1389 {
1390 // Try again...
1391 Con::printf( "Rerequesting server list packet #%d...", p.getIndex() + 1 );
1392 p.tryCount--;
1393 p.time = currentTime;
1394 p.key = gKey++;
1395
1396 BitStream *out = BitStream::getPacketStream();
1397 bool extendedPacket = (sActiveFilter.queryFlags & ServerFilter::NewStyleResponse) != 0;
1398
1399 out->clearStringBuffer();
1400
1401 if ( extendedPacket )
1402 out->write( U8( NetInterface::MasterServerExtendedListRequest ) );
1403 else
1404 out->write( U8( NetInterface::MasterServerListRequest ) );
1405
1406 out->write( U8( sActiveFilter.queryFlags ) ); // flags
1407 out->write( ( session << 16) | ( p.key & 0xFFFF ) );
1408
1409 if ( extendedPacket )
1410 out->write( p.getOldIndex() ); // packet index
1411 else
1412 out->write( p.getIndex() ); // packet index
1413
1414 out->write( U8( 0 ) ); // game type
1415 out->write( U8( 0 ) ); // mission type
1416 out->write( U8( 0 ) ); // minPlayers
1417 out->write( U8( 0 ) ); // maxPlayers
1418 out->write( U32( 0 ) ); // region mask
1419 out->write( U32( 0 ) ); // version
1420 out->write( U8( 0 ) ); // filter flags
1421 out->write( U8( 0 ) ); // max bots
1422 out->write( U16( 0 ) ); // min CPU
1423 out->write( U8( 0 ) ); // buddy count
1424
1425 BitStream::sendPacketStream(&gMasterServerQueryAddress);
1426 }

Callers 3

processMethod · 0.85

Calls 12

printfFunction · 0.85
getRootGroupFunction · 0.85
processPingsAndQueriesFunction · 0.85
clearStringBufferMethod · 0.80
getOldIndexMethod · 0.80
U32Enum · 0.50
postEventFunction · 0.50
getCurrentTimeFunction · 0.50
sizeMethod · 0.45
getIndexMethod · 0.45
eraseMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected