End the connection's streams as the loop ends, not after the shutdown

The ConnectionStreams guard was dropped only after shutdown_connection, which
can wait up to three seconds. The loop no longer reads commands once it has
broken, so a StreamCmd::Shutdown the session sent in that window never
reached the stream task; the task ran on until the guard dropped. Drop the
guard right after the loop. The stream task's shutdown needs nothing of the
connection (it reports to the session's channels), so nothing relied on the
late drop.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-14 18:04:34 +03:00
1 parent ac4464db7b
commit a5125b3998
1 file changed
+5
+5
View File
@@ -461,6 +461,11 @@ async fn run_inner(
Input::Tick => voice.tick(),
}
};
// The streams end now, not after the shutdown below (up to three seconds):
// the commands are not read any more, so a `StreamCmd::Shutdown` the
// session sends from here on would never reach the stream task. Its end
// needs nothing of the connection: it reports to the session's channels.
drop(voice.streams.take());
// Transfers the server never opened fail; running ones go on.
for (_, job) in voice.jobs.drain() {
job.report()(TransferState::Failed("disconnected".into()));