diff options
author | Mattes D <github@xoft.cz> | 2015-01-20 11:27:05 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-01-22 20:13:04 +0100 |
commit | 64855ed340e76779b99f37fbc866a7f5952e11db (patch) | |
tree | 39db86a8cf76dbe486e9a674894383b08144f600 /src/OSSupport/ServerHandleImpl.cpp | |
parent | cTCPLinkImpl: Fixed type conversion warning. (diff) | |
download | cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.tar cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.tar.gz cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.tar.bz2 cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.tar.lz cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.tar.xz cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.tar.zst cuberite-64855ed340e76779b99f37fbc866a7f5952e11db.zip |
Diffstat (limited to 'src/OSSupport/ServerHandleImpl.cpp')
-rw-r--r-- | src/OSSupport/ServerHandleImpl.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/OSSupport/ServerHandleImpl.cpp b/src/OSSupport/ServerHandleImpl.cpp index 866aa01be..d81d4ba46 100644 --- a/src/OSSupport/ServerHandleImpl.cpp +++ b/src/OSSupport/ServerHandleImpl.cpp @@ -173,7 +173,7 @@ bool cServerHandleImpl::Listen(UInt16 a_Port) if (bind(MainSock, reinterpret_cast<const sockaddr *>(&name), sizeof(name)) != 0) { m_ErrorCode = EVUTIL_SOCKET_ERROR(); - Printf(m_ErrorMsg, "Cannot bind IPv6 socket to port %d: %s", a_Port, evutil_socket_error_to_string(m_ErrorCode)); + Printf(m_ErrorMsg, "Cannot bind IPv6 socket to port %d: %d (%s)", a_Port, m_ErrorCode, evutil_socket_error_to_string(m_ErrorCode)); evutil_closesocket(MainSock); return false; } @@ -181,14 +181,14 @@ bool cServerHandleImpl::Listen(UInt16 a_Port) if (evutil_make_socket_nonblocking(MainSock) != 0) { m_ErrorCode = EVUTIL_SOCKET_ERROR(); - Printf(m_ErrorMsg, "Cannot make socket on port %d non-blocking: %s", a_Port, evutil_socket_error_to_string(m_ErrorCode)); + Printf(m_ErrorMsg, "Cannot make socket on port %d non-blocking: %d (%s)", a_Port, m_ErrorCode, evutil_socket_error_to_string(m_ErrorCode)); evutil_closesocket(MainSock); return false; } if (listen(MainSock, 0) != 0) { m_ErrorCode = EVUTIL_SOCKET_ERROR(); - Printf(m_ErrorMsg, "Cannot listen on port %d: %s", a_Port, evutil_socket_error_to_string(m_ErrorCode)); + Printf(m_ErrorMsg, "Cannot listen on port %d: %d (%s)", a_Port, m_ErrorCode, evutil_socket_error_to_string(m_ErrorCode)); evutil_closesocket(MainSock); return false; } @@ -215,6 +215,7 @@ bool cServerHandleImpl::Listen(UInt16 a_Port) err = EVUTIL_SOCKET_ERROR(); LOGD("evutil_make_socket_nonblocking() failed for secondary socket: %d, %s", err, evutil_socket_error_to_string(err)); evutil_closesocket(SecondSock); + return true; // Report as success, the primary socket is working } // Bind to all IPv4 interfaces: @@ -227,7 +228,7 @@ bool cServerHandleImpl::Listen(UInt16 a_Port) err = EVUTIL_SOCKET_ERROR(); LOGD("Cannot bind secondary socket to port %d: %d (%s)", a_Port, err, evutil_socket_error_to_string(err)); evutil_closesocket(SecondSock); - return true; + return true; // Report as success, the primary socket is working } if (listen(SecondSock, 0) != 0) @@ -235,7 +236,7 @@ bool cServerHandleImpl::Listen(UInt16 a_Port) err = EVUTIL_SOCKET_ERROR(); LOGD("Cannot listen on on secondary socket on port %d: %d (%s)", a_Port, err, evutil_socket_error_to_string(err)); evutil_closesocket(SecondSock); - return false; + return true; // Report as success, the primary socket is working } m_SecondaryConnListener = evconnlistener_new(cNetworkSingleton::Get().GetEventBase(), Callback, this, LEV_OPT_CLOSE_ON_FREE | LEV_OPT_REUSEABLE, 0, SecondSock); |