aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorMatt Corallo <[email protected]>2017-03-08 14:41:57 -0500
committerMatt Corallo <[email protected]>2017-03-08 14:41:57 -0500
commite007b243c4840e44857b5ccf686ed35899e44af0 (patch)
tree5b24688f7f4bf20b86887e59d223b323a87338fe /src/net.cpp
parentMerge #9952: Add historical release notes for 0.14.0 (diff)
downloaddiscoin-e007b243c4840e44857b5ccf686ed35899e44af0.tar.xz
discoin-e007b243c4840e44857b5ccf686ed35899e44af0.zip
Fix shutdown hang with >= 8 -addnodes set
We previously would block waiting for a CSemaphoreGrant in ThreadOpenAddedConnections, when we did not need to. This would block as the posts in CConnman shutdown were both to the wrong semaphore and in the wrong location.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 6ff63d473..12c62d9da 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2322,6 +2322,10 @@ void CConnman::Interrupt()
if (semOutbound)
for (int i=0; i<(nMaxOutbound + nMaxFeeler); i++)
semOutbound->post();
+
+ if (semAddnode)
+ for (int i=0; i<nMaxAddnode; i++)
+ semAddnode->post();
}
void CConnman::Stop()
@@ -2337,10 +2341,6 @@ void CConnman::Stop()
if (threadSocketHandler.joinable())
threadSocketHandler.join();
- if (semAddnode)
- for (int i=0; i<nMaxAddnode; i++)
- semOutbound->post();
-
if (fAddressesInitialized)
{
DumpData();