diff --git a/src/omega/omega_connection.rs b/src/omega/omega_connection.rs index a1fb418..a5e08dc 100644 --- a/src/omega/omega_connection.rs +++ b/src/omega/omega_connection.rs @@ -160,6 +160,12 @@ impl OmegaConnection { handle.abort(); } + // Recreate shutdown_tx if it was taken by stop() + if self.shutdown_tx.lock().await.is_none() { + let (shutdown_tx, _) = watch::channel(false); + *self.shutdown_tx.lock().await = Some(shutdown_tx); + } + // Set reconnect flag *self.reconnect_on_close.write().await = true; diff --git a/src/rho/connection.rs b/src/rho/connection.rs index 7f1fafc..bb668f8 100755 --- a/src/rho/connection.rs +++ b/src/rho/connection.rs @@ -356,6 +356,15 @@ impl GeneralConnection { expected, response ); + let err_msg = CommunicationValue::new(CommunicationType::error) + .with_id(cv.get_id()) + .add_data( + DataTypes::message, + DataValue::Str( + "Challenge response mismatch — authentication rejected".to_string(), + ), + ); + let _ = self.sender.send(&err_msg).await; } } else { log_err!(