Fix socket errors being clobbered by closeSocket()
This commit is contained in:
parent
5ddd53e17f
commit
e74fe2b016
1 changed files with 6 additions and 2 deletions
|
|
@ -53,6 +53,8 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
|
|||
char buf[1024];
|
||||
} resp;
|
||||
|
||||
sock = INVALID_SOCKET;
|
||||
|
||||
err = initializePlatformSockets();
|
||||
if (err != 0) {
|
||||
Limelog("Failed to initialize sockets: %d\n", err);
|
||||
|
|
@ -111,8 +113,6 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
|
|||
}
|
||||
}
|
||||
|
||||
closeSocket(sock);
|
||||
|
||||
if (bytesRead == 0) {
|
||||
Limelog("No response from STUN server\n");
|
||||
err = -2;
|
||||
|
|
@ -183,6 +183,10 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
|
|||
err = -6;
|
||||
|
||||
Exit:
|
||||
if (sock != INVALID_SOCKET) {
|
||||
closeSocket(sock);
|
||||
}
|
||||
|
||||
if (stunAddrs != NULL) {
|
||||
freeaddrinfo(stunAddrs);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue