aboutsummaryrefslogtreecommitdiff
path: root/src/rpcserver.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2015-09-24 17:29:22 +0200
committerWladimir J. van der Laan <[email protected]>2015-09-28 15:06:20 +0200
commit5e0c22135600fe36811da3b78216efc61ba765fb (patch)
tree0d43f766390191a3b3db1ed0bb1a3f85da618a4a /src/rpcserver.cpp
parentMerge pull request #6724 (diff)
downloaddiscoin-5e0c22135600fe36811da3b78216efc61ba765fb.tar.xz
discoin-5e0c22135600fe36811da3b78216efc61ba765fb.zip
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.
Diffstat (limited to 'src/rpcserver.cpp')
-rw-r--r--src/rpcserver.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index b831d3d3b..dbee61efc 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -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";
}