deadlock comment

This commit is contained in:
Théo Monnom
2022-12-20 23:16:49 +01:00
parent 1ed925dd38
commit e3905d56b5
2 changed files with 4 additions and 4 deletions
@@ -66,15 +66,12 @@ pub enum EngineEvent {
rtp_receiver: RtpReceiver, rtp_receiver: RtpReceiver,
streams: Vec<MediaStream>, streams: Vec<MediaStream>,
}, },
Connected,
Resuming, Resuming,
Resumed, Resumed,
SignalResumed,
Restarting, Restarting,
Restarted, Restarted,
} }
//
// TODO(theomonnom): Smarter retry intervals // TODO(theomonnom): Smarter retry intervals
pub(crate) const RECONNECT_ATTEMPTS: u32 = 10; pub(crate) const RECONNECT_ATTEMPTS: u32 = 10;
pub(crate) const RECONNECT_INTERVAL: Duration = Duration::from_millis(300); pub(crate) const RECONNECT_INTERVAL: Duration = Duration::from_millis(300);
@@ -220,6 +220,7 @@ impl RTCSession {
} }
/// Close the PeerConnections and the SignalClient /// Close the PeerConnections and the SignalClient
#[tracing::instrument]
pub async fn close(self) { pub async fn close(self) {
// Close the tasks // Close the tasks
self.close_emitter.send(true); self.close_emitter.send(true);
@@ -468,13 +469,14 @@ impl SessionInner {
}); });
} }
#[tracing::instrument]
async fn close(&self) { async fn close(&self) {
self.signal_client.close().await; self.signal_client.close().await;
self.publisher_pc.lock().await.close(); self.publisher_pc.lock().await.close();
self.subscriber_pc.lock().await.close(); self.subscriber_pc.lock().await.close();
} }
#[tracing::instrument] #[tracing::instrument(skip(data))]
async fn publish_data( async fn publish_data(
&self, &self,
data: &DataPacket, data: &DataPacket,
@@ -577,6 +579,7 @@ impl SessionInner {
} }
}; };
// TODO(theomonnom) Avoid 15 seconds deadlock on the RTCEngine by recv close here
tokio::select! { tokio::select! {
_ = wait_connected => Ok(()), _ = wait_connected => Ok(()),
_ = sleep(MAX_ICE_CONNECT_TIMEOUT) => { _ = sleep(MAX_ICE_CONNECT_TIMEOUT) => {