Skip to content

Commit

Permalink
net: stop both net/net_processing before destroying them
Browse files Browse the repository at this point in the history
This should avoid either attempting to use an invalid reference/pointer to the
other.

Github-Pull: bitcoin#10756
Rebased-From: 2525b97
  • Loading branch information
theuni authored and MarcoFalke committed Nov 2, 2017
1 parent b4136f2 commit 0a5477c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ void Shutdown()
}
#endif
MapPort(false);

// Because these depend on each-other, we make sure that neither can be
// using the other before destroying them.
UnregisterValidationInterface(peerLogic.get());
g_connman.reset();
g_connman->Stop();
peerLogic.reset();
g_connman.reset();

StopTorControl();
if (fDumpMempoolLater && gArgs.GetArg("-persistmempool", DEFAULT_PERSIST_MEMPOOL)) {
Expand Down

0 comments on commit 0a5477c

Please sign in to comment.