This mimics closely `CConnman::SocketEvents()` and the underlying
`poll(2)`.
rename `ERR` to `err` in sock.cpp::Sock::Accept to fix warning ` declaration shadows a static data member of 'Sock'`
This is a partial backport of core#24356
https://github.com/bitcoin/bitcoin/pull/24356/commits/cc74459768063a923fb6220a4f420eaf211aee7b
Depends on D17131