Skip to content

Commit f4b1fe7

Browse files
committed
Merge #16412: net: Make poll in InterruptibleRecv only filter for POLLIN events.
a52818c net: Make poll in InterruptibleRecv only filter for POLLIN events. poll should block until there is data to be read or the timeout expires. (tecnovert) Pull request description: 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. When USE_POLL is not defined select is used with the writefds parameter set to nullptr. Removing POLLOUT causes the behavior of poll to match that of select. Fixes: #16004. ACKs for top commit: laanwj: code review ACK a52818c jonasschnelli: utACK a52818c Tree-SHA512: 69934cc14e3327c7ff7f6c5942af8761e865220b2540d74ea1e176adad326307a73860417dddfd32d601b5c0e9e2ada1848bd7e3d27b0b7a9b42f11129af8eb1
2 parents c7b7cf2 + a52818c commit f4b1fe7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static IntrRecvError InterruptibleRecv(uint8_t* data, size_t len, int timeout, c
347347
#ifdef USE_POLL
348348
struct pollfd pollfd = {};
349349
pollfd.fd = hSocket;
350-
pollfd.events = POLLIN | POLLOUT;
350+
pollfd.events = POLLIN;
351351
int nRet = poll(&pollfd, 1, timeout_ms);
352352
#else
353353
struct timeval tval = MillisToTimeval(timeout_ms);

0 commit comments

Comments
 (0)