| 632 | //----------------------------------------------------------------------------- |
| 633 | |
| 634 | void cancelServerQuery() |
| 635 | { |
| 636 | // Cancel the current query, if there is anything left |
| 637 | // on the ping list, it's dropped. |
| 638 | if ( sgServerQueryActive ) |
| 639 | { |
| 640 | Con::printf( "Server query canceled." ); |
| 641 | ServerInfo* si; |
| 642 | |
| 643 | // Clear the master server packet list: |
| 644 | gPacketStatusList.clear(); |
| 645 | |
| 646 | // Clear the ping list: |
| 647 | while ( gPingList.size() ) |
| 648 | { |
| 649 | si = findServerInfo( &gPingList[0].address ); |
| 650 | if ( si && !si->status.test( ServerInfo::Status_Responded ) ) |
| 651 | si->status = ServerInfo::Status_TimedOut; |
| 652 | |
| 653 | gPingList.erase( U32( 0 ) ); |
| 654 | } |
| 655 | |
| 656 | // Clear the query list: |
| 657 | while ( gQueryList.size() ) |
| 658 | { |
| 659 | si = findServerInfo( &gQueryList[0].address ); |
| 660 | if ( si && !si->status.test( ServerInfo::Status_Responded ) ) |
| 661 | si->status = ServerInfo::Status_TimedOut; |
| 662 | |
| 663 | gQueryList.erase( U32( 0 ) ); |
| 664 | } |
| 665 | |
| 666 | sgServerQueryActive = false; |
| 667 | gServerBrowserDirty = true; |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | DefineEngineFunction( cancelServerQuery, void, (), , "cancelServerQuery();" ) |
| 672 | { |