Copy send_message result for send_state

This commit is contained in:
2024-12-23 19:55:32 -06:00
parent bc39909f3c
commit 0ab8ad9660
2 changed files with 8 additions and 4 deletions

View File

@@ -105,7 +105,9 @@ async fn handle_socket(session_id: u32, websocket: WebSocket) {
.expect("Unable to get session"); .expect("Unable to get session");
session.tx = Some(tx_channel); session.tx = Some(tx_channel);
session.send_state(); session
.send_state()
.expect("Failed to buffer state message");
session session
.send_message(executable_message) .send_message(executable_message)
.expect("Failed to buffer executables message"); .expect("Failed to buffer executables message");
@@ -196,7 +198,9 @@ pub async fn download(req: &mut Request, res: &mut Response, depot: &mut Depot)
// Don't try to send state if somehow the session has not connected // Don't try to send state if somehow the session has not connected
if session.tx.is_some() { if session.tx.is_some() {
session.send_state(); session
.send_state()
.expect("Failed to buffer state message");
} else { } else {
tracing::warn!("Download being made without any connection websocket"); tracing::warn!("Download being made without any connection websocket");
} }

View File

@@ -67,12 +67,12 @@ impl Session {
} }
} }
pub fn send_state(&mut self) { pub fn send_state(&mut self) -> Result<(), anyhow::Error> {
let message = OutgoingMessage::State { let message = OutgoingMessage::State {
session: self.clone(), session: self.clone(),
}; };
self.send_message(message); self.send_message(message)
} }
} }