| 1823 | //----------------------------------------------------------------------------- |
| 1824 | |
| 1825 | static void handleGamePingResponse( const NetAddress* address, BitStream* stream, U32 key, U8 /*flags*/ ) |
| 1826 | { |
| 1827 | // Broadcast has timed out or query has been cancelled: |
| 1828 | if( !gPingList.size() ) |
| 1829 | return; |
| 1830 | |
| 1831 | S32 index = findPingEntry( gPingList, address ); |
| 1832 | if( index == -1 ) |
| 1833 | { |
| 1834 | // an anonymous ping response - if it's not already timed |
| 1835 | // out or finished, ping it. Probably from a broadcast |
| 1836 | if( !addressFinished( address ) ) |
| 1837 | pushPingRequest( address ); |
| 1838 | return; |
| 1839 | } |
| 1840 | Ping &p = gPingList[index]; |
| 1841 | U32 infoKey = ( p.session << 16 ) | ( p.key & 0xFFFF ); |
| 1842 | if( infoKey != key ) |
| 1843 | return; |
| 1844 | |
| 1845 | // Find if the server info already exists (favorite or refreshing): |
| 1846 | ServerInfo* si = findServerInfo( address ); |
| 1847 | bool applyFilter = false; |
| 1848 | if ( sActiveFilter.type == ServerFilter::Normal ) |
| 1849 | applyFilter = si ? !si->isUpdating() : true; |
| 1850 | |
| 1851 | char addrString[256]; |
| 1852 | Net::addressToString( address, addrString ); |
| 1853 | bool waitingForMaster = ( sActiveFilter.type == ServerFilter::Normal ) && !gGotFirstListPacket; |
| 1854 | |
| 1855 | // Verify the version: |
| 1856 | char buf[256]; |
| 1857 | stream->readString( buf ); |
| 1858 | if ( String::compare( buf, versionString ) != 0 ) |
| 1859 | { |
| 1860 | // Version is different, so remove it from consideration: |
| 1861 | Con::printf( "Server %s is a different version.", addrString ); |
| 1862 | Con::printf( "Wanted version %s, got version %s", versionString, buf); |
| 1863 | gFinishedList.push_back( *address ); |
| 1864 | gPingList.erase( index ); |
| 1865 | if ( si ) |
| 1866 | { |
| 1867 | si->status = ServerInfo::Status_TimedOut; |
| 1868 | gServerBrowserDirty = true; |
| 1869 | } |
| 1870 | if ( !waitingForMaster ) |
| 1871 | updatePingProgress(); |
| 1872 | return; |
| 1873 | } |
| 1874 | |
| 1875 | // See if the server meets our minimum protocol: |
| 1876 | U32 temp32; |
| 1877 | stream->read( &temp32 ); |
| 1878 | if ( temp32 < GameConnection::MinRequiredProtocolVersion ) |
| 1879 | { |
| 1880 | Con::printf( "Protocol for server %s does not meet minimum protocol.", addrString ); |
| 1881 | gFinishedList.push_back( *address ); |
| 1882 | gPingList.erase( index ); |
no test coverage detected