mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-07-04 00:36:37 +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];
|
char buf[1024];
|
||||||
} resp;
|
} resp;
|
||||||
|
|
||||||
|
sock = INVALID_SOCKET;
|
||||||
|
|
||||||
err = initializePlatformSockets();
|
err = initializePlatformSockets();
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
Limelog("Failed to initialize sockets: %d\n", err);
|
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) {
|
if (bytesRead == 0) {
|
||||||
Limelog("No response from STUN server\n");
|
Limelog("No response from STUN server\n");
|
||||||
err = -2;
|
err = -2;
|
||||||
@ -183,6 +183,10 @@ int LiFindExternalAddressIP4(const char* stunServer, unsigned short stunPort, un
|
|||||||
err = -6;
|
err = -6;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
|
if (sock != INVALID_SOCKET) {
|
||||||
|
closeSocket(sock);
|
||||||
|
}
|
||||||
|
|
||||||
if (stunAddrs != NULL) {
|
if (stunAddrs != NULL) {
|
||||||
freeaddrinfo(stunAddrs);
|
freeaddrinfo(stunAddrs);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user