Merge #10013: Fix shutdown hang with >= 8 -addnodes set (0.14 backport)

4e2502b Add missing braces in semaphore posts in net (Matt Corallo)
d2548a4 Fix shutdown hang with >= 8 -addnodes set (Matt Corallo)

Tree-SHA512: 0b157793a2c7fabbc2ed24f974d206fc01c816189d6b6aa5a61bab562a0034f72b643a19b1e7920061e479fb27eddd4abf1c40e772a9573346b221a08e7e5ed9
This commit is contained in:
Wladimir J. van der Laan 2017-03-18 11:37:44 +01:00
commit fa8c6ddbef
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 10 additions and 6 deletions

View File

@ -2318,9 +2318,17 @@ void CConnman::Interrupt()
interruptNet();
InterruptSocks5(true);
if (semOutbound)
for (int i=0; i<(nMaxOutbound + nMaxFeeler); i++)
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()
@ -2336,10 +2344,6 @@ void CConnman::Stop()
if (threadSocketHandler.joinable())
threadSocketHandler.join();
if (semAddnode)
for (int i=0; i<nMaxAddnode; i++)
semOutbound->post();
if (fAddressesInitialized)
{
DumpData();