diff options
author | truelight <truelight@openttd.org> | 2005-01-11 15:52:18 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2005-01-11 15:52:18 +0000 |
commit | 553c169dbc86d71bec70942f0c9ec0a589b52c8d (patch) | |
tree | 562c694b0df934d73498ae1fe0e861fc3847c606 | |
parent | 8c7acd8719129fe98e2e4233064db53893ccfd63 (diff) | |
download | openttd-553c169dbc86d71bec70942f0c9ec0a589b52c8d.tar.xz |
(svn r1483) -Fix: don't close a socket if it is already closed (windows doesn't like
it :() (partly tnx to tamlin)
-rw-r--r-- | network_udp.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/network_udp.c b/network_udp.c index bd319322a..0d62dec3a 100644 --- a/network_udp.c +++ b/network_udp.c @@ -368,17 +368,23 @@ void NetworkUDPClose(void) DEBUG(net, 1) ("[NET][UDP] Closed listeners"); if (_network_udp_server) { - closesocket(_udp_server_socket); - _udp_server_socket = INVALID_SOCKET; + if (_udp_server_socket != INVALID_SOCKET) { + closesocket(_udp_server_socket); + _udp_server_socket = INVALID_SOCKET; + } - closesocket(_udp_master_socket); - _udp_master_socket = INVALID_SOCKET; + if (_udp_master_socket != INVALID_SOCKET) { + closesocket(_udp_master_socket); + _udp_master_socket = INVALID_SOCKET; + } _network_udp_server = false; _network_udp_broadcast = 0; } else { - closesocket(_udp_client_socket); - _udp_client_socket = INVALID_SOCKET; + if (_udp_client_socket != INVALID_SOCKET) { + closesocket(_udp_client_socket); + _udp_client_socket = INVALID_SOCKET; + } _network_udp_broadcast = 0; } } |