net: change ConnectSocketDirectly() to take a Sock argument

Change `ConnectSocketDirectly()` to take a `Sock` argument instead of a
bare `SOCKET`. With this, use the `Sock`'s (possibly mocked) methods
`Connect()`, `Wait()` and `GetSockOpt()` instead of calling the OS
functions directly.
This commit is contained in:
Vasil Dimov
2021-03-05 17:01:59 +01:00
parent b5861100f8
commit 82d360b5a8
4 changed files with 27 additions and 40 deletions

View File

@@ -279,7 +279,7 @@ Sock Session::Hello() const
throw std::runtime_error("Cannot create socket");
}
if (!ConnectSocketDirectly(m_control_host, sock->Get(), nConnectTimeout, true)) {
if (!ConnectSocketDirectly(m_control_host, *sock, nConnectTimeout, true)) {
throw std::runtime_error(strprintf("Cannot connect to %s", m_control_host.ToString()));
}