HomePhabricator

Merge #16412: net: Make poll in InterruptibleRecv only filter for POLLIN events.

Description

Merge #16412: net: Make poll in InterruptibleRecv only filter for POLLIN events.

Summary:
a52818cc5633494992da7d1dc8fdb04b4a1b7c29 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 a52818cc5633494992da7d1dc8fdb04b4a1b7c29
jonasschnelli:
  utACK a52818cc5633494992da7d1dc8fdb04b4a1b7c29

Tree-SHA512: 69934cc14e3327c7ff7f6c5942af8761e865220b2540d74ea1e176adad326307a73860417dddfd32d601b5c0e9e2ada1848bd7e3d27b0b7a9b42f11129af8eb1

Backport of Core PR16412

Test Plan:

ninja check-all
src/bitcoind

Verify normal operation.

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, majcosta

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, majcosta

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D6630

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Jul 19 2019, 15:15
nakihitoCommitted on Jun 18 2020, 22:14
nakihitoPushed on Jun 18 2020, 22:14
Reviewer
Restricted Owners Package
Differential Revision
D6630: Merge #16412: net: Make poll in InterruptibleRecv only filter for POLLIN events.
Parents
rABCf3691320504a: Fix missing braces
Branches
Unknown
Tags
Unknown