Browse Source

clean this up a bit

jake 4 years ago
committed by andy
parent
commit
1f6532f09c
  1. 16
      src/common/mainloop/interserver.rs

16
src/common/mainloop/interserver.rs

@ -156,16 +156,16 @@ where
match output_loop_receiver.recv().await { match output_loop_receiver.recv().await {
Ok(msg) => { Ok(msg) => {
let payload = serde_json::to_string(&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;
} }
} }
}, },

Loading…
Cancel
Save