| 1672 | //----------------------------------------------------------------------------- |
| 1673 | |
| 1674 | static void handleGamePingResponse( const NetAddress* address, BitStream* stream, U32 key, U8 /*flags*/ ) |
| 1675 | { |
| 1676 | // Broadcast has timed out or query has been cancelled: |
| 1677 | if( !gPingList.size() ) |
| 1678 | return; |
| 1679 | |
| 1680 | S32 index = findPingEntry( gPingList, address ); |
| 1681 | if( index == -1 ) |
| 1682 | { |
| 1683 | // an anonymous ping response - if it's not already timed |
| 1684 | // out or finished, ping it. Probably from a broadcast |
| 1685 | if( !addressFinished( address ) ) |
| 1686 | pushPingRequest( address ); |
| 1687 | return; |
| 1688 | } |
| 1689 | Ping &p = gPingList[index]; |
| 1690 | U32 infoKey = ( p.session << 16 ) | ( p.key & 0xFFFF ); |
| 1691 | if( infoKey != key ) |
| 1692 | return; |
| 1693 | |
| 1694 | // Find if the server info already exists (favorite or refreshing): |
| 1695 | ServerInfo* si = findServerInfo( address ); |
| 1696 | bool applyFilter = false; |
| 1697 | if ( sActiveFilter.type == ServerFilter::Normal ) |
| 1698 | applyFilter = si ? !si->isUpdating() : true; |
| 1699 | |
| 1700 | char addrString[256]; |
| 1701 | Net::addressToString( address, addrString ); |
| 1702 | bool waitingForMaster = ( sActiveFilter.type == ServerFilter::Normal ) && !gGotFirstListPacket; |
| 1703 | |
| 1704 | // Verify the version: |
| 1705 | char buf[256]; |
| 1706 | stream->readString( buf ); |
| 1707 | if ( dStrcmp( buf, versionString ) != 0 ) |
| 1708 | { |
| 1709 | // Version is different, so remove it from consideration: |
| 1710 | Con::printf( "Server %s is a different version.", addrString ); |
| 1711 | gFinishedList.push_back( *address ); |
| 1712 | gPingList.erase( index ); |
| 1713 | if ( si ) |
| 1714 | { |
| 1715 | si->status = ServerInfo::Status_TimedOut; |
| 1716 | gServerBrowserDirty = true; |
| 1717 | } |
| 1718 | if ( !waitingForMaster ) |
| 1719 | updatePingProgress(); |
| 1720 | return; |
| 1721 | } |
| 1722 | |
| 1723 | // See if the server meets our minimum protocol: |
| 1724 | U32 temp32; |
| 1725 | stream->read( &temp32 ); |
| 1726 | if ( temp32 < GameConnection::MinRequiredProtocolVersion ) |
| 1727 | { |
| 1728 | Con::printf( "Protocol for server %s does not meet minimum protocol.", addrString ); |
| 1729 | gFinishedList.push_back( *address ); |
| 1730 | gPingList.erase( index ); |
| 1731 | if ( si ) |
no test coverage detected