summaryrefslogtreecommitdiff
path: root/lib/server
diff options
context:
space:
mode:
Diffstat (limited to 'lib/server')
-rw-r--r--lib/server/SocketStream.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/server/SocketStream.cpp b/lib/server/SocketStream.cpp
index ebc57041..88bf386a 100644
--- a/lib/server/SocketStream.cpp
+++ b/lib/server/SocketStream.cpp
@@ -161,17 +161,26 @@ void SocketStream::Open(int Type, const char *Name, int Port)
{
// Dispose of the socket
#ifdef WIN32
+ DWORD err = WSAGetLastError();
::closesocket(mSocketHandle);
#else
+ int err = errno;
::close(mSocketHandle);
#endif
+
BOX_ERROR("Failed to connect to socket (type " << Type <<
", name " << Name << ", port " << Port << "): " <<
- "error " << errno << " (" << strerror(errno) <<
- ")");
+ #ifdef WIN32
+ GetErrorMessage(err)
+ #else
+ strerror(err) << " (" << err << ")"
+ #endif
+ );
+
mSocketHandle = INVALID_SOCKET_VALUE;
THROW_EXCEPTION(ConnectionException, Conn_SocketConnectError)
}
+
ResetCounters();
}