diff --git a/src/conetty/multiplex_client.rs b/src/conetty/multiplex_client.rs index cecae3f..0b5886f 100644 --- a/src/conetty/multiplex_client.rs +++ b/src/conetty/multiplex_client.rs @@ -95,7 +95,7 @@ impl Client for MultiplexClient { let id: usize = id.into(); let buf = req.finish(id as u64); - self.sock.write(buf); + self.sock.write(buf)?; // wait for the rsp Ok(waiter.wait_rsp(self.timeout)?) diff --git a/src/conetty/queued_writer.rs b/src/conetty/queued_writer.rs index 877c9d6..08a487a 100644 --- a/src/conetty/queued_writer.rs +++ b/src/conetty/queued_writer.rs @@ -49,7 +49,7 @@ impl QueuedWriter { } /// it's safe and efficient to call this API concurrently - pub fn write(&self, data: Vec) { + pub fn write(&self, data: Vec) -> std::io::Result<()> { self.data_queue.push(data); // only allow the first writer perform the write operation // other concurrent writers would just push the data @@ -70,10 +70,8 @@ impl QueuedWriter { } } - if let Err(e) = writer.write_all() { - // FIXME: handle the error - error!("QueuedWriter failed, err={}", e); - } + writer.write_all()?; } + Ok(()) } } diff --git a/src/conetty/server.rs b/src/conetty/server.rs index 559754d..e0a4cb1 100644 --- a/src/conetty/server.rs +++ b/src/conetty/server.rs @@ -141,7 +141,7 @@ pub trait TcpServer: Server { info!("send rsp: id={}", req.id); // send the result back to client - w_stream.write(data); + w_stream.write(data).expect("tcp write to client failed"); }); } }); @@ -206,7 +206,7 @@ pub trait UdsServer: Server { info!("send rsp: id={}", req.id); // send the result back to client - w_stream.write(data); + w_stream.write(data).expect("uds write to client failed"); }); } });