Page MenuHomePhabricator

D10996.diff
No OneTemporary

D10996.diff

diff --git a/services/identity/src/websockets/mod.rs b/services/identity/src/websockets/mod.rs
--- a/services/identity/src/websockets/mod.rs
+++ b/services/identity/src/websockets/mod.rs
@@ -25,7 +25,7 @@
use crate::constants::{
IDENTITY_SERVICE_WEBSOCKET_ADDR, SOCKET_HEARTBEAT_TIMEOUT,
};
-use send::{send_error_response, send_message, WebsocketSink};
+use send::{send_message, WebsocketSink};
pub mod errors;
#[derive(Serialize, Deserialize)]
@@ -298,7 +298,7 @@
ping_timeout = Box::pin(tokio::time::sleep(SOCKET_HEARTBEAT_TIMEOUT));
if let Err(e) = handle_websocket_frame(text, outgoing.clone()).await {
- send_error_response(e, outgoing.clone()).await;
+ error!("Error handling WebSocket frame: {}", e);
continue;
};
}
diff --git a/services/identity/src/websockets/send.rs b/services/identity/src/websockets/send.rs
--- a/services/identity/src/websockets/send.rs
+++ b/services/identity/src/websockets/send.rs
@@ -8,33 +8,9 @@
use hyper_tungstenite::WebSocketStream;
use tracing::error;
-use crate::websockets::errors;
-
pub type WebsocketSink =
Arc<Mutex<SplitSink<WebSocketStream<Upgraded>, Message>>>;
-pub async fn send_error_response(
- error: errors::WebsocketError,
- outgoing: WebsocketSink,
-) {
- let response_msg = serde_json::json!({
- "action": "errorMessage",
- "error": format!("{}", error)
- });
-
- match serde_json::to_string(&response_msg) {
- Ok(serialized_response) => {
- send_message(Message::Text(serialized_response), outgoing).await;
- }
- Err(serialize_error) => {
- error!(
- "Failed to serialize the error response: {:?}",
- serialize_error
- );
- }
- }
-}
-
pub async fn send_message(message: Message, outgoing: WebsocketSink) {
if let Err(e) = outgoing.lock().await.send(message).await {
error!("Failed to send message to device: {}", e);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 3:02 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675120
Default Alt Text
D10996.diff (1 KB)

Event Timeline