diff options
Diffstat (limited to 'lib/server/SocketStream.cpp')
-rw-r--r-- | lib/server/SocketStream.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/server/SocketStream.cpp b/lib/server/SocketStream.cpp index 6ef4b8d1..7c92ebba 100644 --- a/lib/server/SocketStream.cpp +++ b/lib/server/SocketStream.cpp @@ -154,16 +154,24 @@ void SocketStream::Open(Socket::Type Type, const std::string& rName, int Port) int sockDomain = 0; SocketAllAddr addr; int addrLen = 0; +<<<<<<< HEAD + Socket::NameLookupToSockAddr(addr, sockDomain, Type, rName, Port, addrLen); +======= Socket::NameLookupToSockAddr(addr, sockDomain, Type, rName, Port, addrLen); +>>>>>>> 0.12 // Create the socket mSocketHandle = ::socket(sockDomain, SOCK_STREAM, 0 /* let OS choose protocol */); if(mSocketHandle == INVALID_SOCKET_VALUE) { +<<<<<<< HEAD + BOX_LOG_SYS_ERROR("Failed to create a network socket"); +======= BOX_LOG_SOCKET_ERROR(Type, rName, Port, "Failed to create a network socket"); +>>>>>>> 0.12 THROW_EXCEPTION(ServerException, SocketOpenError) } @@ -171,11 +179,24 @@ void SocketStream::Open(Socket::Type Type, const std::string& rName, int Port) if(::connect(mSocketHandle, &addr.sa_generic, addrLen) == -1) { // Dispose of the socket +<<<<<<< HEAD +#ifdef WIN32 + DWORD err = WSAGetLastError(); + ::closesocket(mSocketHandle); + BOX_LOG_WIN_ERROR_NUMBER("Failed to connect to socket " + "(type " << Type << ", name " << rName << + ", port " << Port << ")", err); +#else // !WIN32 + BOX_LOG_SYS_ERROR("Failed to connect to socket (type " << + Type << ", name " << rName << ", port " << Port << + ")"); +======= BOX_LOG_SOCKET_ERROR(Type, rName, Port, "Failed to connect to socket"); #ifdef WIN32 ::closesocket(mSocketHandle); #else // !WIN32 +>>>>>>> 0.12 ::close(mSocketHandle); #endif // WIN32 |