net: add new method Sock::Listen() that wraps listen()

This will help to increase `Sock` usage and make more code mockable.
This commit is contained in:
Vasil Dimov
2021-04-13 16:43:04 +02:00
parent 3ad7de225e
commit b2733ab6a8
6 changed files with 35 additions and 1 deletions

View File

@@ -79,6 +79,11 @@ int Sock::Bind(const sockaddr* addr, socklen_t addr_len) const
return bind(m_socket, addr, addr_len);
}
int Sock::Listen(int backlog) const
{
return listen(m_socket, backlog);
}
std::unique_ptr<Sock> Sock::Accept(sockaddr* addr, socklen_t* addr_len) const
{
#ifdef WIN32