mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Make HTTP server shutdown more graceful
Shutting down the HTTP server currently breaks off all current requests. This can create a race condition with RPC `stop` command, where the calling process never receives confirmation. This change removes the listening sockets on shutdown so that no new requests can come in, but no longer breaks off requests in progress. Meant to fix #6717.
This commit is contained in:
@@ -243,7 +243,8 @@ UniValue stop(const UniValue& params, bool fHelp)
|
||||
throw runtime_error(
|
||||
"stop\n"
|
||||
"\nStop Bitcoin server.");
|
||||
// Shutdown will take long enough that the response should get back
|
||||
// Event loop will exit after current HTTP requests have been handled, so
|
||||
// this reply will get back to the client.
|
||||
StartShutdown();
|
||||
return "Bitcoin server stopping";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user