mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-19 17:55:37 +00:00
Factor out logic to gracelessly kill the connection
This commit is contained in:
@@ -694,10 +694,7 @@ where
|
||||
self.endpoint_events.push_back(EndpointEventInner::Drained);
|
||||
}
|
||||
Timer::Idle => {
|
||||
self.close_common();
|
||||
self.events.push_back(ConnectionError::TimedOut.into());
|
||||
self.state = State::Drained;
|
||||
self.endpoint_events.push_back(EndpointEventInner::Drained);
|
||||
self.kill(ConnectionError::TimedOut);
|
||||
}
|
||||
Timer::KeepAlive => {
|
||||
trace!("sending keep-alive");
|
||||
@@ -2945,6 +2942,14 @@ where
|
||||
self.in_flight.ack_eliciting -= u64::from(packet.ack_eliciting);
|
||||
self.spaces[space].in_flight -= u64::from(packet.size);
|
||||
}
|
||||
|
||||
/// Terminate the connection instantly, without sending a close packet
|
||||
fn kill(&mut self, reason: ConnectionError) {
|
||||
self.close_common();
|
||||
self.events.push_back(reason.into());
|
||||
self.state = State::Drained;
|
||||
self.endpoint_events.push_back(EndpointEventInner::Drained);
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> fmt::Debug for Connection<S>
|
||||
|
||||
Reference in New Issue
Block a user