@@ -91,35 +91,41 @@ std::unique_ptr<ClientNetworkStunSocketH
p->Send_string(token);
p->Send_uint8(family);
stun_handler->SendPacket(p);
return stun_handler;
}
NetworkRecvStatus ClientNetworkStunSocketHandler::CloseConnection(bool error)
{
NetworkStunSocketHandler::CloseConnection(error);
/* If our connecter is still pending, shut it down too. Otherwise the
* callback of the connecter can call into us, and our object is most
* likely about to be destroyed. */
/* Also make sure any pending connecter is killed ASAP. */
if (this->connecter != nullptr) {
this->connecter->Kill();
this->connecter = nullptr;
return NETWORK_RECV_STATUS_OKAY;
ClientNetworkStunSocketHandler::~ClientNetworkStunSocketHandler()
/**
* Check whether we received/can send some data from/to the STUN server and
* when that's the case handle it appropriately.
*/
void ClientNetworkStunSocketHandler::SendReceive()
if (this->sock == INVALID_SOCKET) return;
/* We never attempt to receive anything on a STUN socket. After
* connecting a STUN connection, the local address will be reused to
* to establish the connection with the real server. If we would be to
* read this socket, some OSes get confused and deliver us packets meant