mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-07-03 08:15:32 +00:00
Fix socket errors being clobbered by closeSocket()
This commit is contained in:
parent
5ddd53e17f
commit
e74fe2b016
@ -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…
x
Reference in New Issue
Block a user