summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-04-08 21:03:00 +0000
committerrubidium <rubidium@openttd.org>2009-04-08 21:03:00 +0000
commite779c56e31010fe2036f049e875d2de58b4fc7d3 (patch)
treef488b4c89241ad346a14b276510b82b7a43a8048 /src
parent1d4318c0d16cb6017fc41027fa96d042851dbf10 (diff)
downloadopenttd-e779c56e31010fe2036f049e875d2de58b4fc7d3.tar.xz
(svn r15989) -Fix (r15987: segfault due to uninitialised sockets.
Diffstat (limited to 'src')
-rw-r--r--src/network/network.cpp2
-rw-r--r--src/network/network_udp.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 5fd68650b..e442e46d6 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -587,7 +587,6 @@ static void NetworkClose()
_listensockets.Clear();
DEBUG(net, 1, "Closed listener");
}
- NetworkUDPClose();
TCPConnecter::KillAll();
@@ -1088,6 +1087,7 @@ void NetworkStartUp()
void NetworkShutDown()
{
NetworkDisconnect();
+ NetworkUDPClose();
DEBUG(net, 3, "[core] shutting down network");
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index c1da7df43..b59ebfb7d 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -520,6 +520,9 @@ void NetworkUDPAdvertise()
void NetworkUDPInitialize()
{
+ /* If not closed, then do it. */
+ if (_udp_server_socket != NULL) NetworkUDPClose();
+
DEBUG(net, 1, "[udp] initializing listeners");
assert(_udp_client_socket == NULL && _udp_server_socket == NULL && _udp_master_socket == NULL);