aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortecnovert <tecnovert@particl.io>2019-07-18 13:04:16 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2019-07-19 17:59:01 +0200
commit063c8ce7a0544e7fef58ddd19860e884689f149c (patch)
tree07bbfa7686dea41b0bee83594abcaf11778d8632
parent3f76160087c04ce29fd4a4b08838107a25a540a9 (diff)
downloadbitcoin-063c8ce7a0544e7fef58ddd19860e884689f149c.tar.xz
net: Make poll in InterruptibleRecv only filter for POLLIN events.
poll should block until there is data to be read or the timeout expires. Filtering for the POLLOUT event causes poll to return immediately which leads to high CPU usage when trying to connect to non-responding peers through tor. Removing POLLOUT matches how select is used when USE_POLL isn't defined. Github-Pull: #16412 Rebased-From: a52818cc5633494992da7d1dc8fdb04b4a1b7c29 Tree-SHA512: eaf466630ba9d2a2a7443c9679c83c2cb13e779a5948f409cddb4c48cf32126ac68f3de48e394f9302e99858efa17cdb14650751a1b55c3b79e8a7507cab352d
-rw-r--r--src/netbase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 6c386a9ade..51e78d41fa 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -268,7 +268,7 @@ static IntrRecvError InterruptibleRecv(uint8_t* data, size_t len, int timeout, c
#ifdef USE_POLL
struct pollfd pollfd = {};
pollfd.fd = hSocket;
- pollfd.events = POLLIN | POLLOUT;
+ pollfd.events = POLLIN;
int nRet = poll(&pollfd, 1, timeout_ms);
#else
struct timeval tval = MillisToTimeval(timeout_ms);