mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: ensure OnConnect() always gets called with a valid socket (#9729)
This should already be the case, but now assert()s will tell us if this isn't.
This commit is contained in:
parent
802ca4e722
commit
9c36c12c85
|
@ -217,6 +217,8 @@ Packet *NetworkTCPSocketHandler::ReceivePacket()
|
|||
*/
|
||||
bool NetworkTCPSocketHandler::CanSendReceive()
|
||||
{
|
||||
assert(this->sock != INVALID_SOCKET);
|
||||
|
||||
fd_set read_fd, write_fd;
|
||||
struct timeval tv;
|
||||
|
||||
|
|
|
@ -451,6 +451,8 @@ bool TCPServerConnecter::CheckActivity()
|
|||
*/
|
||||
void TCPServerConnecter::SetConnected(SOCKET sock)
|
||||
{
|
||||
assert(sock != INVALID_SOCKET);
|
||||
|
||||
this->socket = sock;
|
||||
this->status = Status::CONNECTED;
|
||||
}
|
||||
|
|
|
@ -566,6 +566,8 @@ void ClientNetworkCoordinatorSocketHandler::ConnectFailure(const std::string &to
|
|||
*/
|
||||
void ClientNetworkCoordinatorSocketHandler::ConnectSuccess(const std::string &token, SOCKET sock, NetworkAddress &address)
|
||||
{
|
||||
assert(sock != INVALID_SOCKET);
|
||||
|
||||
/* Connecter will destroy itself. */
|
||||
this->game_connecter = nullptr;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
{
|
||||
this->handler->connecter = nullptr;
|
||||
|
||||
handler->sock = s;
|
||||
this->handler->sock = s;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue