Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/socket/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ impl<'a> Socket<'a> {
// we still can receive indefinitely.
State::FinWait1 | State::FinWait2 => true,
// If we have something in the receive buffer, we can receive that.
_ if !self.rx_buffer.is_empty() => true,
_ if self.can_recv() => true,
_ => false,
}
}
Expand Down Expand Up @@ -1213,14 +1213,9 @@ impl<'a> Socket<'a> {
self.tx_buffer.capacity()
}

/// Check whether the receive half of the full-duplex connection buffer is open
/// (see [may_recv](#method.may_recv)), and the receive buffer is not empty.
/// Check whether the receive buffer is not empty.
#[inline]
pub fn can_recv(&self) -> bool {
if !self.may_recv() {
return false;
}

!self.rx_buffer.is_empty()
}

Expand Down