From 45f0cc35ddf9c65e983e7d86a507073dbafbc528 Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 16 Jun 2021 20:09:19 -0600 Subject: [PATCH] clean this up a bit --- src/common/mainloop/interserver.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/mainloop/interserver.rs b/src/common/mainloop/interserver.rs index 7e4b95d..8d25bd2 100644 --- a/src/common/mainloop/interserver.rs +++ b/src/common/mainloop/interserver.rs @@ -156,16 +156,16 @@ where match output_loop_receiver.recv().await { Ok(msg) => { let payload = serde_json::to_string(&msg); - if let Ok(payload) = payload { - let len_bytes = u32::to_le_bytes(payload.len() as u32); + if let Ok(payload2) = payload { + let len_bytes = u32::to_le_bytes(payload2.len() as u32); - match socket.write_all(&len_bytes).await { - Ok(_) => {}, - Err(err) => warn!("send failed: {:?}", err), + if let Err(err) = socket.write_all(&len_bytes).await { + warn!("interserver send failed: {:?}", err); + break; } - match socket.write_all(&payload.as_bytes()).await { - Ok(_) => {}, - Err(err) => warn!("send failed: {:?}", err), + if let Err(err) = socket.write_all(&payload2.as_bytes()).await { + warn!("intserserver send failed: {:?}", err); + break; } } },