Skip to content

Commit

Permalink
Close without error if just missing FIN-ACK
Browse files Browse the repository at this point in the history
Close errors will be used more, when #98 lands, which returns the close
error to clients who wait for the stream to exit.
  • Loading branch information
carver committed Aug 8, 2023
1 parent bac4fd7 commit 8929d8b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,16 @@ impl<const N: usize, P: ConnectionPeer> Connection<N, P> {
State::Closing { local_fin, remote_fin, .. } => unacked.len() == 1 && local_fin.is_some() && &local_fin.unwrap() == unacked.last().unwrap() && remote_fin.is_some(),
_ => false,
};
if finished {

let err = if finished {
tracing::debug!(?self.state, ?unacked, "idle timeout expired, but only missing ACK for local FIN");
None
} else {
tracing::warn!(?self.state, ?unacked, "closing, idle for too long...");
}
Some(Error::TimedOut)
};

self.state = State::Closed { err: Some(Error::TimedOut) };
self.state = State::Closed { err };
}
}
_ = &mut shutdown, if !shutting_down => {
Expand Down

0 comments on commit 8929d8b

Please sign in to comment.