Introduce an accept(2) wrapper Sock::Accept() and extend the usage of Sock in CConnman::ListenSocket and CreateNodeFromAcceptedSocket().
The aim of this change is to progress towards making all network code mockable.
net: add new method Sock::Accept() that wraps accept()
This will help to increase Sock usage and make more code mockable.
net: use Sock in CConnman::ListenSocket
Change CConnman::ListenSocket to use a pointer to Sock instead of a
bare SOCKET and use Sock::Accept() instead of bare accept(). This
will help mocking / testing / fuzzing more code.
net: change CreateNodeFromAcceptedSocket() to take Sock
Change CConnman::CreateNodeFromAcceptedSocket() to take a Sock
argument instead of SOCKET.This makes the method mockable and also a little bit shorter as some
CloseSocket() calls are removed (the socket will be closed
automatically by the Sock destructor on early return).
net: don't check if the listening socket is valid
Listening sockets in CConnman::vhListenSocket are always valid
(underlying file descriptor is not INVALID_SOCKET).
This is a backport of core#21879 and core#23601
Depends on D17137