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

Function handleGameInfoResponse

engine/source/network/serverQuery.cc:1876–2022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1874//-----------------------------------------------------------------------------
1875
1876static void handleGameInfoResponse( const NetAddress* address, BitStream* stream, U32 /*key*/, U8 /*flags*/ )
1877{
1878 if ( !gQueryList.size() )
1879 return;
1880
1881 S32 index = findPingEntry( gQueryList, address );
1882 if ( index == -1 )
1883 return;
1884
1885 // Remove the server from the query list since it has been so kind as to respond:
1886 gQueryList.erase( index );
1887 updateQueryProgress();
1888 ServerInfo *si = findServerInfo( address );
1889 if ( !si )
1890 return;
1891
1892 bool isUpdate = si->isUpdating();
1893 bool applyFilter = !isUpdate && ( sActiveFilter.type == ServerFilter::Normal );
1894 char addrString[256];
1895 Net::addressToString( address, addrString );
1896
1897 // Get the rules set:
1898 char stringBuf[2048]; // Who knows how big this should be?
1899 stream->readString( stringBuf );
1900 if ( !si->gameType || dStricmp( si->gameType, stringBuf ) != 0 )
1901 {
1902 si->gameType = (char*) dRealloc( (void*) si->gameType, dStrlen( stringBuf ) + 1 );
1903 dStrcpy( si->gameType, stringBuf );
1904
1905 // Test against the active filter:
1906 if ( applyFilter && dStricmp( sActiveFilter.gameType, "any" ) != 0
1907 && dStricmp( si->gameType, sActiveFilter.gameType ) != 0 )
1908 {
1909 Con::printf( "Server %s filtered out by rules set. (%s:%s)", addrString, sActiveFilter.gameType, si->gameType );
1910 removeServerInfo( address );
1911 return;
1912 }
1913 }
1914
1915 // Get the mission type:
1916 stream->readString( stringBuf );
1917 if ( !si->missionType || dStrcmp( si->missionType, stringBuf ) != 0 )
1918 {
1919 si->missionType = (char*) dRealloc( (void*) si->missionType, dStrlen( stringBuf ) + 1 );
1920 dStrcpy( si->missionType, stringBuf );
1921
1922 // Test against the active filter:
1923 if ( applyFilter && dStricmp( sActiveFilter.missionType, "any" ) != 0
1924 && dStricmp( si->missionType, sActiveFilter.missionType ) != 0 )
1925 {
1926 Con::printf( "Server %s filtered out by mission type. (%s:%s)", addrString, sActiveFilter.missionType, si->missionType );
1927 removeServerInfo( address );
1928 return;
1929 }
1930 }
1931
1932 // Get the mission name:
1933 stream->readString( stringBuf );

Callers 1

handleInfoPacketMethod · 0.85

Calls 15

findPingEntryFunction · 0.85
updateQueryProgressFunction · 0.85
findServerInfoFunction · 0.85
printfFunction · 0.85
removeServerInfoFunction · 0.85
readLongCStringFunction · 0.85
isUpdatingMethod · 0.80
isPasswordedMethod · 0.80
dStricmpFunction · 0.50
dStrlenFunction · 0.50
dStrcpyFunction · 0.50
dStrcmpFunction · 0.50

Tested by

no test coverage detected