Skip to content

Commit

Permalink
Fix shutdown hang with >= 8 -addnodes set
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheBlueMatt committed Mar 8, 2017
1 parent 6996e06 commit e007b24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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();
Expand Down

0 comments on commit e007b24

Please sign in to comment.