diff --git a/src/Network.cpp b/src/Network.cpp index e4f92e4..157d1df 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -83,10 +83,13 @@ bool Network::netConnect() { if (connect(mSock, addr->ai_addr, addr->ai_addrlen) < 0) { std::cerr << "unable to connect to host: " << strerror(errno) << "\n"; - break; + freeaddrinfo(addrs); + netClose(); + return false; } } + // socket failed for all addrs if (mSock < 0) { freeaddrinfo(addrs); netClose();