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.
  • Loading branch information
theuni committed Sep 7, 2017
1 parent 80e2e9d commit 2525b97
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 @@ -194,9 +194,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 2525b97

Please sign in to comment.