this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Send a closeframe for invalid json

+6 -2
+6 -2
server/src/client_communication.rs
··· 42 42 use rocket::State; 43 43 use std::net::IpAddr; 44 44 use uuid::Uuid; 45 + use ws::frame::{CloseCode, CloseFrame}; 45 46 46 47 #[get("/connection")] 47 48 pub(crate) async fn wsconnection<'k>( ··· 116 117 info_elog!(ev_log,"Session revival failed: database error: {:?}", postgres_error); 117 118 } 118 119 } 119 - 120 + 120 121 _ => { 121 122 info_elog!(ev_log,"Session revival failed: {:?}", e); 122 123 } ··· 396 397 error_elog!(ev_log, "Error deserialising message: {:?}\n\n{}" , e, 397 398 format!("The message: {}", possibly_json).style_dim() 398 399 ); 399 - let _ = stream.send(ws::Message::from("unknown")).await; 400 + let _ = stream.close(Some(CloseFrame { 401 + code: CloseCode::Invalid, 402 + reason: std::borrow::Cow::Borrowed("Serialisation error"), 403 + })).await; 400 404 } 401 405 } 402 406 }