Skip to content

Commit a52818c

Browse files
committed
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.
1 parent 0515406 commit a52818c

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)