aboutsummaryrefslogtreecommitdiff
path: root/src/network/connection.h
diff options
context:
space:
mode:
authorBřetislav Štec <valsiterb@gmail.com>2015-08-01 13:53:15 +0200
committerest31 <MTest31@outlook.com>2015-08-01 20:44:17 +0200
commit79e2647556773d46cc0299e73ca23c41a153ff2a (patch)
treef8b23e9f84b1d3f9bd8d32b5c37d42115d38816f /src/network/connection.h
parentc39a85a88d1f905014c1ced6b87638cdb01e6ddf (diff)
downloadminetest-79e2647556773d46cc0299e73ca23c41a153ff2a.tar.gz
minetest-79e2647556773d46cc0299e73ca23c41a153ff2a.tar.bz2
minetest-79e2647556773d46cc0299e73ca23c41a153ff2a.zip
src/network/connection.h: Fix race condition
Diffstat (limited to 'src/network/connection.h')
-rw-r--r--src/network/connection.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/connection.h b/src/network/connection.h
index b1f9e70a8..c48da2c70 100644
--- a/src/network/connection.h
+++ b/src/network/connection.h
@@ -1053,7 +1053,11 @@ protected:
void PrintInfo(std::ostream &out);
void PrintInfo();
- std::list<u16> getPeerIDs() { return m_peer_ids; }
+ std::list<u16> getPeerIDs()
+ {
+ JMutexAutoLock peerlock(m_peers_mutex);
+ return m_peer_ids;
+ }
UDPSocket m_udpSocket;
MutexedQueue<ConnectionCommand> m_command_queue;