I split the accepting of the new connections into its own method, that is independent of CConnMan::SocketHandler()
, does its own socket polling and can be called independently from CConnMan::SocketHandler()
. However after doing that, the following realization dawned on me (tldr: I ditched that):
:bulb: We don’t want to wait separately for incoming connections because that event is “rare”, meaning most of the time we would just sleep for some time until poll(2)
times out, signaling no socket is ready for IO (no new incoming connections). This would have an adverse effect on the throughput - even on busy nodes that constantly have incoming/outgoing data, we would needlessly sleep for a short while, frequently.
So, we want to poll(2)
the already connected sockets and the listening ones together, in one poll(2)
call.
I made some changes to CConnMan::SocketHander()
to (hopefully) make it easier to read, see #21943 (comment)