From b7badd980f12a6a426abe3b7cc5f7a2a8ce60ebe Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 21 Nov 2010 14:31:35 +0000 Subject: [PATCH] added mutex to correct data race between bdNodeManager::iteration() and bdnodeManager::incomingMsg() git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3840 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/udp/udpbitdht.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libbitdht/src/udp/udpbitdht.cc b/libbitdht/src/udp/udpbitdht.cc index 5f88ed57a..04f6576c5 100644 --- a/libbitdht/src/udp/udpbitdht.cc +++ b/libbitdht/src/udp/udpbitdht.cc @@ -65,6 +65,7 @@ UdpBitDht::UdpBitDht(UdpPublisher *pub, bdNodeId *id, std::string appVersion, st #endif /* setup nodeManager */ + bdStackMutex stack(dhtMtx); /********** MUTEX LOCKED *************/ mBitDhtManager = new bdNodeManager(id, usedVersion, bootstrapfile, fns); } @@ -208,7 +209,10 @@ void UdpBitDht::run() usleep(TICK_PAUSE_USEC); } - mBitDhtManager->iteration(); + { + bdStackMutex stack(dhtMtx); /********** MUTEX LOCKED *************/ + mBitDhtManager->iteration(); + } sleep(1); } }