Browse Source

handle error

pbs
jake 4 years ago
parent
commit
cd1c30c8eb
  1. 9
      src/common/mainloop/interserver.rs

9
src/common/mainloop/interserver.rs

@ -147,8 +147,8 @@ where
async_std::task::spawn(async move { async_std::task::spawn(async move {
loop { loop {
info!("login send loop"); info!("login send loop");
let msg = output_loop_receiver.recv().await.unwrap();
match output_loop_receiver.recv().await {
Ok(msg) => {
let payload = serde_json::to_string(&msg); let payload = serde_json::to_string(&msg);
if let Ok(payload) = payload { if let Ok(payload) = payload {
let len_bytes = u32::to_le_bytes(payload.len() as u32); let len_bytes = u32::to_le_bytes(payload.len() as u32);
@ -162,6 +162,11 @@ where
Err(err) => warn!("send failed: {:?}", err), Err(err) => warn!("send failed: {:?}", err),
} }
} }
},
Err(err) => {
warn!("error in send_loop: {:?}, {:?}", server_id, err)
}
}
} }
}); });
} }

Loading…
Cancel
Save