mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-23 00:19:53 +00:00
Fix UDP thread terminations
This commit is contained in:
@@ -80,12 +80,16 @@ static void ReceiveThreadProc(void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
err = (int)recv(rtpSocket, buffer, receiveSize, 0);
|
||||
if (err <= 0) {
|
||||
Limelog("Video Receive: recv() failed: %d\n", (int)LastSocketError());
|
||||
err = recvUdpSocket(rtpSocket, buffer, receiveSize);
|
||||
if (err < 0) {
|
||||
Limelog("Video Receive: recvUdpSocket() failed: %d\n", (int)LastSocketError());
|
||||
ListenerCallbacks.connectionTerminated(LastSocketError());
|
||||
break;
|
||||
}
|
||||
else if (err == 0) {
|
||||
// Receive timed out; try again
|
||||
continue;
|
||||
}
|
||||
|
||||
memcpy(&buffer[receiveSize], &err, sizeof(int));
|
||||
|
||||
@@ -161,9 +165,6 @@ void stopVideoStream(void) {
|
||||
if (firstFrameSocket != INVALID_SOCKET) {
|
||||
shutdownTcpSocket(firstFrameSocket);
|
||||
}
|
||||
if (rtpSocket != INVALID_SOCKET) {
|
||||
shutdownUdpSocket(rtpSocket);
|
||||
}
|
||||
|
||||
PltJoinThread(&udpPingThread);
|
||||
PltJoinThread(&receiveThread);
|
||||
|
||||
Reference in New Issue
Block a user