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.
pull/764/head
tecnovert 5 years ago
parent 0515406acb
commit a52818cc56
No known key found for this signature in database
GPG Key ID: 13F13651C9CF0D6B

@ -347,7 +347,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);

Loading…
Cancel
Save