Skip to content

Commit

Permalink
fix: High CPU Usage (100%) in Specific Scenarios (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
leibeiyi committed Jun 3, 2024
1 parent 357127e commit 15df34b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/codec/framed_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,18 @@ where
}
_ => {
tracing::trace!(queued_data_frame = false);
ready!(poll_write_buf(
let n = ready!(poll_write_buf(
Pin::new(&mut self.inner),
cx,
&mut self.encoder.buf
))?
))?;
if n == 0 {
return Poll::Ready(Err(io::Error::new(
io::ErrorKind::WriteZero,
"failed to write frame to socket",
)));
}
n
}
};
}
Expand Down

0 comments on commit 15df34b

Please sign in to comment.