summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);