MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CloseTurnHandler

Method CloseTurnHandler

src/network/network_coordinator.cpp:664–677  ·  view source on GitHub ↗

* Close the TURN handler. * @param token The token used for the TURN handler. */

Source from the content-addressed store, hash-verified

662 * @param token The token used for the TURN handler.
663 */
664void ClientNetworkCoordinatorSocketHandler::CloseTurnHandler(std::string_view token)
665{
666 CloseWindowByClass(WC_NETWORK_ASK_RELAY, NRWCD_HANDLED);
667
668 auto turn_it = this->turn_handlers.find(token);
669 if (turn_it == this->turn_handlers.end()) return;
670
671 turn_it->second->CloseConnection();
672 turn_it->second->CloseSocket();
673
674 /* We don't remove turn_handler here, as we can be called from within that
675 * turn_handler instance, so our object cannot be freed yet. Instead, we
676 * check later if the connection is closed, and free the object then. */
677}
678
679/**
680 * Close everything related to this connection token.

Callers 2

CloseTokenMethod · 0.95
CloseAllConnectionsMethod · 0.95

Calls 5

CloseWindowByClassFunction · 0.85
findMethod · 0.45
endMethod · 0.45
CloseConnectionMethod · 0.45
CloseSocketMethod · 0.45

Tested by

no test coverage detected