mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-18 14:20:02 +00:00
Kill TCP sockets in 2 stages to fix a race condition during socket closure
This commit is contained in:
@@ -392,19 +392,23 @@ int stopControlStream(void) {
|
||||
LbqSignalQueueShutdown(&invalidReferenceFrameTuples);
|
||||
PltSetEvent(&invalidateRefFramesEvent);
|
||||
|
||||
if (ctlSock != INVALID_SOCKET) {
|
||||
shutdownSocket(ctlSock);
|
||||
}
|
||||
|
||||
PltInterruptThread(&lossStatsThread);
|
||||
PltInterruptThread(&invalidateRefFramesThread);
|
||||
|
||||
if (ctlSock != INVALID_SOCKET) {
|
||||
closeSocket(ctlSock);
|
||||
ctlSock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
PltJoinThread(&lossStatsThread);
|
||||
PltJoinThread(&invalidateRefFramesThread);
|
||||
|
||||
PltCloseThread(&lossStatsThread);
|
||||
PltCloseThread(&invalidateRefFramesThread);
|
||||
|
||||
if (ctlSock != INVALID_SOCKET) {
|
||||
closeSocket(ctlSock);
|
||||
ctlSock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user