aboutsummaryrefslogtreecommitdiff
path: root/src/httprpc.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-02-21 09:20:51 -0800
committerMarcoFalke <falke.marco@gmail.com>2020-02-21 10:06:21 -0800
commitfa9af06d91e9357e86863781746f0e78a509967e (patch)
tree84da5bbd0c028648b9ec383dabc80849d2f15d18 /src/httprpc.cpp
parentfa4620be782c2bf6b5ffddf4f671194fdd1536f3 (diff)
downloadbitcoin-fa9af06d91e9357e86863781746f0e78a509967e.tar.xz
scripted-diff: Replace MilliSleep with UninterruptibleSleep
This is safe because MilliSleep is never executed in a boost::thread, the only type of thread that is interruptible. * The RPC server uses std::thread * The wallet is either executed in an RPC thread or the main thread * bitcoin-cli, benchmarks and tests are only one thread (the main thread) -BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/MilliSleep\((\S+)\);/UninterruptibleSleep(std::chrono::milliseconds{\1});/g' $(git grep -l MilliSleep) -END VERIFY SCRIPT-
Diffstat (limited to 'src/httprpc.cpp')
-rw-r--r--src/httprpc.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index ff75789223..4d49736140 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -174,7 +174,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
/* Deter brute-forcing
If this results in a DoS the user really
shouldn't have their RPC port exposed. */
- MilliSleep(250);
+ UninterruptibleSleep(std::chrono::milliseconds{250});
req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
req->WriteReply(HTTP_UNAUTHORIZED);