mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-24 08:58:08 +00:00
Kill TCP sockets in 2 stages to fix a race condition during socket closure
This commit is contained in:
@@ -294,12 +294,16 @@ int stopInputStream(void) {
|
||||
PltInterruptThread(&inputSendThread);
|
||||
|
||||
if (inputSock != INVALID_SOCKET) {
|
||||
closeSocket(inputSock);
|
||||
inputSock = INVALID_SOCKET;
|
||||
shutdownSocket(inputSock);
|
||||
}
|
||||
|
||||
PltJoinThread(&inputSendThread);
|
||||
PltCloseThread(&inputSendThread);
|
||||
|
||||
if (inputSock != INVALID_SOCKET) {
|
||||
closeSocket(inputSock);
|
||||
inputSock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user