Review report

bitcoin/bitcoin: PR #36716

1 suggestion

Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Early poll-error disconnects lose the socket error detail

When poll reports an error without read readiness, the new P2P and HTTP early-disconnect paths can discard socket error detail previously available in debug logs.

Location: src/net.cpp:2223 (head).

Details and suggested fix

On a Linux USE_POLL build, a P2P peer with receiving paused and output pending is monitored only for sending. If poll reports POLLERR or POLLHUP without POLLIN, this branch now closes the socket before SocketSendData or recv can log a permanent error with NetworkErrorString. DisconnectMsg supplies only peer identification. The HTTP early-disconnect branch similarly bypasses its detailed send/read error logs. Preserve available diagnostics by reading SO_ERROR before disconnecting, with the socket lifetime protected by m_sock_mutex, and appending NetworkErrorString when the lookup succeeds and returns a nonzero error. Apply the same treatment to HTTP while retaining the early disconnect. This concerns only -debug=net and -debug=http diagnostics. A plain hangup can have SO_ERROR equal to zero, and Windows urgent-data indications need not have a socket error to report.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.