Browse Source

Improve logging of failed connections

0.10
Gavin Andresen 11 years ago
parent
commit
0f90613cbe
  1. 10
      src/netbase.cpp

10
src/netbase.cpp

@ -367,13 +367,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe @@ -367,13 +367,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
int nRet = select(hSocket + 1, NULL, &fdset, NULL, &timeout);
if (nRet == 0)
{
LogPrint("net", "connection timeout\n");
LogPrint("net", "connection to %s timeout\n", addrConnect.ToString().c_str());
closesocket(hSocket);
return false;
}
if (nRet == SOCKET_ERROR)
{
LogPrintf("select() for connection failed: %i\n",WSAGetLastError());
LogPrintf("select() for %s failed: %i\n", addrConnect.ToString().c_str(), WSAGetLastError());
closesocket(hSocket);
return false;
}
@ -384,13 +384,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe @@ -384,13 +384,13 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR)
#endif
{
LogPrintf("getsockopt() for connection failed: %i\n",WSAGetLastError());
LogPrintf("getsockopt() for %s failed: %i\n", addrConnect.ToString().c_str(), WSAGetLastError());
closesocket(hSocket);
return false;
}
if (nRet != 0)
{
LogPrintf("connect() failed after select(): %s\n",strerror(nRet));
LogPrintf("connect() to %s failed after select(): %s\n", addrConnect.ToString().c_str(), strerror(nRet));
closesocket(hSocket);
return false;
}
@ -401,7 +401,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe @@ -401,7 +401,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
else
#endif
{
LogPrintf("connect() failed: %i\n",WSAGetLastError());
LogPrintf("connect() to %s failed: %i\n", addrConnect.ToString().c_str(), WSAGetLastError());
closesocket(hSocket);
return false;
}

Loading…
Cancel
Save