webrtc-rs / webrtc

A pure Rust implementation of WebRTC
https://webrtc.rs
Apache License 2.0
3.95k stars 347 forks source link

Udp connection not close (reopen #195) #551

Closed shiqifeng2000 closed 3 months ago

shiqifeng2000 commented 3 months ago

hi,

I have opened this ticket before, in previous session #174/#195, I describe some bug about udp not closing issue, thanks for the help from your maintainer, the issue is fixed.

Recently when I double check, it seems that's only for a receiver, which means, if server send stream to a client, when client drops, the server shall close its udp connection. But it seems when server receive stream from a client, when client drops, the server NEVER close its udp connections

Here's how you can reproduce it. You may use the example->save-to-disk-h264, add a few lines below the peer_connection.close().awat

peer_connection.close().await?; 

drop(peer_connection);
loop { tokio::time::sleep(Duration::from_secs(1)).await; }

that will drop the connection after closing and enter an infinite loop but not close the process

then back to the work-flow, follow the official instruction from save-to-disk-h264, when client stream is saving to the disk, close the web page, which will trigger a disconnect event, then ctrl+c to terminate the server part, and use this command lsof -i -P | grep save-to(linux/mac) to check the port opened, you will get many udp ports not closed.

this can be reproduced from version 0.8~0.10

could you check and find the cause plz?