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

Function handleGamePingRequest

engine/source/network/serverQuery.cc:1631–1670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1629//-----------------------------------------------------------------------------
1630
1631static void handleGamePingRequest( const NetAddress* address, U32 key, U8 flags )
1632{
1633 // Do not respond if a mission is not running:
1634 if ( GNet->doesAllowConnections() )
1635 {
1636 // Do not respond if this is a single-player game:
1637 if ( dStricmp( Con::getVariable( "Server::ServerType" ), "SinglePlayer" ) == 0 )
1638 return;
1639
1640 // Do not respond to offline queries if this is an online server:
1641 if ( flags & ServerFilter::OfflineQuery )
1642 return;
1643
1644 // some banning code here (?)
1645
1646 BitStream *out = BitStream::getPacketStream();
1647
1648 out->write( U8( NetInterface::GamePingResponse ) );
1649 out->write( flags );
1650 out->write( key );
1651 if ( flags & ServerFilter::NoStringCompress )
1652 writeCString( out, versionString );
1653 else
1654 out->writeString( versionString );
1655 out->write( GameConnection::CurrentProtocolVersion );
1656 out->write( GameConnection::MinRequiredProtocolVersion );
1657 out->write( getVersionNumber() );
1658
1659 // Enforce a 24-character limit on the server name:
1660 char serverName[25];
1661 dStrncpy( serverName, Con::getVariable( "Pref::Server::Name" ), 24 );
1662 serverName[24] = 0;
1663 if ( flags & ServerFilter::NoStringCompress )
1664 writeCString( out, serverName );
1665 else
1666 out->writeString( serverName );
1667
1668 BitStream::sendPacketStream(address);
1669 }
1670}
1671
1672//-----------------------------------------------------------------------------
1673

Callers 1

handleInfoPacketMethod · 0.85

Calls 8

getVariableFunction · 0.85
writeCStringFunction · 0.85
getVersionNumberFunction · 0.85
doesAllowConnectionsMethod · 0.80
dStricmpFunction · 0.50
dStrncpyFunction · 0.50
writeMethod · 0.45
writeStringMethod · 0.45

Tested by

no test coverage detected