Skip to content

Commit

Permalink
fix: add missing connection closed error in send_async
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Jul 28, 2023
1 parent 7fef19f commit eb48c86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/msg_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ impl MsgSender {
// offset = 0, prepare to wait
unsafe { self.ring_buf.as_base().rb().register_head_waker(&waker) };
// check the pending state ensues.
if self.ring_buf.is_full() && !self.ring_buf.is_closed() {
if self.ring_buf.is_closed() {
break Ready(Err(std::io::Error::new(
std::io::ErrorKind::Other,
"connection closed",
)));
} else if self.ring_buf.is_full() {
break Pending;
}
}
Expand Down

0 comments on commit eb48c86

Please sign in to comment.