summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/TCPLinkImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/OSSupport/TCPLinkImpl.cpp')
-rw-r--r--src/OSSupport/TCPLinkImpl.cpp10
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);