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