When the client disconnects, recv.read() returns Err, which fell into
the _ => {} catch-all and was ignored. The stream loop kept running,
stream_frames never returned, and the connection counter never
decremented.
Now Ok(Err(_)) triggers the disconnect break, same as Ok(Ok(Some(_))).
Fixed in both ffmpeg and xcap paths.- commit
- 17bc2728c55b8ed47c56ba25e5c30c9df61bb048
- parent
- cc543a92226ac53ed945950552c2661a50e28e5b
- author
- dami etoile <dami.etoile@gmail.com>
| M | src-tauri/ | 4 | ++-- |
@@ -1194,7 +1194,7 @@ async fn stream_frames_ffmpeg(
11941194 11951195 // Check for client disconnect11961196 match tokio::time::timeout(Duration::from_millis(1), recv.read(&mut [0u8; 1])).await {1197- Ok(Ok(Some(_))) => {1197+ Ok(Ok(Some(_))) | Ok(Err(_)) => {11981198 eprintln!("[host] client disconnected");11991199 break;12001200 }@@ -1278,7 +1278,7 @@ async fn stream_frames_xcap(
12781278 );12791279 12801280 match tokio::time::timeout(Duration::from_millis(1), recv.read(&mut [0u8; 1])).await {1281- Ok(Ok(Some(_))) => {1281+ Ok(Ok(Some(_))) | Ok(Err(_)) => {12821282 eprintln!("[host] client disconnected");12831283 break;12841284 }