* Close all pending connection tokens. */
| 698 | * Close all pending connection tokens. |
| 699 | */ |
| 700 | void ClientNetworkCoordinatorSocketHandler::CloseAllConnections() |
| 701 | { |
| 702 | /* Ensure all other pending connection attempts are also killed. */ |
| 703 | if (this->game_connecter != nullptr) { |
| 704 | this->game_connecter->Kill(); |
| 705 | this->game_connecter = nullptr; |
| 706 | } |
| 707 | |
| 708 | /* Mark any pending connecters as failed. */ |
| 709 | for (auto &[token, it] : this->connecter) { |
| 710 | this->CloseStunHandler(token); |
| 711 | this->CloseTurnHandler(token); |
| 712 | it.second->SetFailure(); |
| 713 | |
| 714 | /* Inform the Game Coordinator he can stop trying to connect us to the server. */ |
| 715 | this->ConnectFailure(token, 0); |
| 716 | } |
| 717 | this->stun_handlers.clear(); |
| 718 | this->turn_handlers.clear(); |
| 719 | this->connecter.clear(); |
| 720 | |
| 721 | /* Also close any pending invite-code requests. */ |
| 722 | for (auto &[invite_code, it] : this->connecter_pre) { |
| 723 | it->SetFailure(); |
| 724 | } |
| 725 | this->connecter_pre.clear(); |
| 726 | } |
| 727 | |
| 728 | /** |
| 729 | * Check whether we received/can send some data from/to the Game Coordinator server and |
no test coverage detected