mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-10 09:12:45 +01:00
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.
Github-Pull: #9953
Rebased-From: e007b243c4
This commit is contained in:
@@ -2321,6 +2321,10 @@ void CConnman::Interrupt()
|
|||||||
if (semOutbound)
|
if (semOutbound)
|
||||||
for (int i=0; i<(nMaxOutbound + nMaxFeeler); i++)
|
for (int i=0; i<(nMaxOutbound + nMaxFeeler); i++)
|
||||||
semOutbound->post();
|
semOutbound->post();
|
||||||
|
|
||||||
|
if (semAddnode)
|
||||||
|
for (int i=0; i<nMaxAddnode; i++)
|
||||||
|
semAddnode->post();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnman::Stop()
|
void CConnman::Stop()
|
||||||
@@ -2336,10 +2340,6 @@ void CConnman::Stop()
|
|||||||
if (threadSocketHandler.joinable())
|
if (threadSocketHandler.joinable())
|
||||||
threadSocketHandler.join();
|
threadSocketHandler.join();
|
||||||
|
|
||||||
if (semAddnode)
|
|
||||||
for (int i=0; i<nMaxAddnode; i++)
|
|
||||||
semOutbound->post();
|
|
||||||
|
|
||||||
if (fAddressesInitialized)
|
if (fAddressesInitialized)
|
||||||
{
|
{
|
||||||
DumpData();
|
DumpData();
|
||||||
|
|||||||
Reference in New Issue
Block a user