Skip to content

Commit

Permalink
Check is_fully_acked before failing finish
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Oct 30, 2023
1 parent 2cd1fef commit 6a0228f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions quinn-proto/src/connection/streams/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ impl Send {

pub(super) fn finish(&mut self) -> Result<(), FinishError> {
if let Some(error_code) = self.stop_reason {
// Remote has already stopped the stream ..

if self.pending.is_fully_acked() {
// All data we sent was already acked

tracing::debug!(%error_code, "Stream is already stopped");
self.state = SendState::DataSent {
finish_acked: true, // Pretend that the remote acked the `FIN`. Actually trying to send it would fail because the remote has stopped the stream already.
};

return Ok(())
}

return Err(FinishError::Stopped(error_code))
}

Expand Down

0 comments on commit 6a0228f

Please sign in to comment.