Merge remote-tracking branch 'cgutman/connect_error_trace'

This commit is contained in:
Thomas Bernard 2019-03-09 10:29:11 +01:00
commit 4912dc37e3
1 changed files with 3 additions and 1 deletions

View File

@ -193,6 +193,8 @@ SOCKET connecthostport(const char * host, unsigned short port,
s = INVALID_SOCKET;
for(p = ai; p; p = p->ai_next)
{
if(!ISINVALID(s))
closesocket(s);
s = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if(ISINVALID(s))
continue;
@ -260,7 +262,6 @@ SOCKET connecthostport(const char * host, unsigned short port,
#endif /* #ifdef MINIUPNPC_IGNORE_EINTR */
if(n < 0)
{
closesocket(s);
continue;
}
else
@ -277,6 +278,7 @@ SOCKET connecthostport(const char * host, unsigned short port,
if(n < 0)
{
PRINT_SOCKET_ERROR("connect");
closesocket(s);
return INVALID_SOCKET;
}
#endif /* #ifdef USE_GETHOSTBYNAME */