diff options
| author | Eskil Queseth <eskilq@kth.se> | 2021-05-22 01:27:17 +0200 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2021-05-22 01:27:17 +0200 |
| commit | aa710a3420ef4d834ee1df4099b25f3c83b9c31d (patch) | |
| tree | 1ec20ad483eaf0602f55b1f50fb45826b888b05f /mumd/src/main.rs | |
| parent | f72440096cefecbe62a37813ea3ee6f3cd3c7299 (diff) | |
| download | mum-aa710a3420ef4d834ee1df4099b25f3c83b9c31d.tar.gz | |
rework command response mechanism
Diffstat (limited to 'mumd/src/main.rs')
| -rw-r--r-- | mumd/src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mumd/src/main.rs b/mumd/src/main.rs index 12a8802..0c175c2 100644 --- a/mumd/src/main.rs +++ b/mumd/src/main.rs @@ -8,13 +8,14 @@ mod state; use crate::state::State; +use bytes::{BufMut, BytesMut}; use futures_util::{select, FutureExt, SinkExt, StreamExt}; use log::*; use mumlib::command::{Command, CommandResponse}; use mumlib::setup_logger; +use std::io::ErrorKind; use tokio::{net::{UnixListener, UnixStream}, sync::mpsc}; use tokio_util::codec::{FramedRead, FramedWrite, LengthDelimitedCodec}; -use bytes::{BufMut, BytesMut}; #[tokio::main] async fn main() { @@ -114,7 +115,10 @@ async fn receive_commands( bincode::serialize_into((&mut serialized).writer(), &response).unwrap(); if let Err(e) = writer.send(serialized.freeze()).await { - error!("Error sending response: {:?}", e); + if e.kind() != ErrorKind::BrokenPipe { //if the client closed the connection, ignore logging the error + //we just assume that they just don't want any more packets + error!("Error sending response: {:?}", e); + } break; } } |
