Skip to content

Commit

Permalink
fix: stuck tasks while closing the PCs (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Sep 26, 2023
1 parent 7da0966 commit 0627da4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion livekit/src/rtc_engine/rtc_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,13 @@ impl RtcSession {
/// Close the PeerConnections and the SignalClient
pub async fn close(self) {
// Close the tasks
self.inner.close().await;
let _ = self.close_tx.send(true);
let _ = self.rtc_task.await;
let _ = self.signal_task.await;

// Close the PeerConnections after the task
// So if a sensitive operation is running, we can wait for it
self.inner.close().await;
}

pub async fn publish_data(
Expand Down

0 comments on commit 0627da4

Please sign in to comment.