net: move CreateSock() calls from ConnectNode() to netbase methods

This commit is contained in:
Matthew Zipkin
2023-07-12 12:18:52 -04:00
parent 74f568cb6f
commit 3a7d6548ef
4 changed files with 59 additions and 72 deletions

View File

@@ -326,13 +326,9 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
std::unique_ptr<Sock> Session::Hello() const
{
auto sock = CreateSock(m_control_host.GetSAFamily());
auto sock = ConnectDirectly(m_control_host, true);
if (!sock) {
throw std::runtime_error("Cannot create socket");
}
if (!ConnectSocketDirectly(m_control_host, *sock, nConnectTimeout, true)) {
throw std::runtime_error(strprintf("Cannot connect to %s", m_control_host.ToStringAddrPort()));
}