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/TCPLinkImpl.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 '')
-rw-r--r-- | src/OSSupport/TCPLinkImpl.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/OSSupport/TCPLinkImpl.cpp b/src/OSSupport/TCPLinkImpl.cpp index 3c0775367..f87f68280 100644 --- a/src/OSSupport/TCPLinkImpl.cpp +++ b/src/OSSupport/TCPLinkImpl.cpp @@ -177,13 +177,19 @@ void cTCPLinkImpl::EventCallback(bufferevent * a_BufferEvent, short a_What, void if (a_What & BEV_EVENT_ERROR) { // Choose the proper callback to call based on whether we were waiting for connection or not: + int err = EVUTIL_SOCKET_ERROR(); if (Self->m_ConnectCallbacks != nullptr) { - Self->m_ConnectCallbacks->OnError(EVUTIL_SOCKET_ERROR()); + if (err == 0) + { + // This could be a DNS failure + err = bufferevent_socket_get_dns_error(a_BufferEvent); + } + Self->m_ConnectCallbacks->OnError(err, evutil_socket_error_to_string(err)); } else { - Self->m_Callbacks->OnError(*Self, EVUTIL_SOCKET_ERROR()); + Self->m_Callbacks->OnError(*Self, err, evutil_socket_error_to_string(err)); if (Self->m_Server == nullptr) { cNetworkSingleton::Get().RemoveLink(Self); |