summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-04 22:11:26 +0000
committerrubidium <rubidium@openttd.org>2012-01-04 22:11:26 +0000
commitc5304501933e2ed473a0a588a7a9b8b63d70db7d (patch)
treebd2e23e3213d2525f1c841ea50b26a9c7f4ed336
parent531e501b5a9b255c9694b62228baa8c962bf4c60 (diff)
downloadopenttd-c5304501933e2ed473a0a588a7a9b8b63d70db7d.tar.xz
(svn r23752) -Fix [FS#4938]: missing locking causing crash is extreme case when being in the MP lobby
-rw-r--r--src/network/network_udp.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index 58d0f31c5..94a677245 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -678,6 +678,8 @@ void NetworkUDPClose()
/** Receive the UDP packets. */
void NetworkBackgroundUDPLoop()
{
+ _network_udp_mutex->BeginCritical();
+
if (_network_udp_server) {
_udp_server_socket->ReceivePackets();
_udp_master_socket->ReceivePackets();
@@ -685,6 +687,8 @@ void NetworkBackgroundUDPLoop()
_udp_client_socket->ReceivePackets();
if (_network_udp_broadcast > 0) _network_udp_broadcast--;
}
+
+ _network_udp_mutex->EndCritical();
}
#endif /* ENABLE_NETWORK */