Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions moonshine-core/src/session/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,21 @@ impl SessionManager {
pub(crate) async fn update_keys(&self, keys: SessionKeyData) -> Result<(), ()> {
let guard = self.inner.lock().await;

if guard.session.is_none() {
tracing::warn!("No active session to update keys for.");
if guard.stop.is_shutdown_triggered() {
tracing::warn!("Session is shutting down; rejecting resume key update.");
return Err(());
}

if !matches!(guard.session.as_ref(), Some(SessionState::Active(_))) {
tracing::warn!("No active streaming session to update keys for.");
return Err(());
}

if let Some(keys_tx) = &guard.keys_tx {
keys_tx.send_replace(keys);
} else {
tracing::warn!("No active session to update keys for.");
tracing::warn!("Active streaming session has no key sender; rejecting resume.");
return Err(());
}

Ok(())
Expand Down