Refactor write_frame
This commit is contained in:
parent
ebf41ecb05
commit
f4eb7213ab
1 changed files with 4 additions and 5 deletions
|
|
@ -61,13 +61,12 @@ impl Connection {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn write_frame(&mut self, frame: &Frame) -> crate::Result<()> {
|
||||
pub async fn write_frame(&mut self, frame: &Frame) -> tokio::io::Result<()> {
|
||||
debug!(?frame);
|
||||
if let Frame::Response(mean) = frame {
|
||||
let _ = self.stream.write(&[mean.to_ne_bytes()[0]]).await?;
|
||||
let _ = self.stream.flush().await?;
|
||||
info!("Wrote frame to stream");
|
||||
return Ok(());
|
||||
let res = self.stream.write(&mean.to_ne_bytes()).await?;
|
||||
info!("Write frame Response to stream");
|
||||
return self.stream.flush().await;
|
||||
}
|
||||
|
||||
Err("Wrong frame".into())
|
||||
|
|
|
|||
Loading…
Reference in a new issue