mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-23 19:48:19 +00:00
Log connection states explicitly
This commit is contained in:
@@ -3831,7 +3831,6 @@ impl Connection {
|
||||
self.stats.frame_rx.record(&frame);
|
||||
|
||||
if let Frame::Close(_error) = frame {
|
||||
trace!("draining");
|
||||
self.state.move_to_draining(None);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
use bytes::Bytes;
|
||||
use tracing::trace;
|
||||
|
||||
use crate::frame::Close;
|
||||
use crate::{ApplicationClose, ConnectionClose, ConnectionError, TransportError, TransportErrorCode};
|
||||
use crate::{
|
||||
ApplicationClose, ConnectionClose, ConnectionError, TransportError, TransportErrorCode,
|
||||
};
|
||||
|
||||
#[allow(unreachable_pub)] // fuzzing only
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -54,13 +57,15 @@ impl State {
|
||||
|
||||
pub(super) fn move_to_handshake(&mut self, hs: Handshake) {
|
||||
self.inner = InnerState::Handshake(hs);
|
||||
trace!("connection state: handshake");
|
||||
}
|
||||
|
||||
pub(super) fn move_to_established(&mut self) {
|
||||
self.inner = InnerState::Established;
|
||||
trace!("connection state: established");
|
||||
}
|
||||
|
||||
/// Moves to a draining state.
|
||||
/// Moves to the drained state.
|
||||
///
|
||||
/// Panics if the state was already drained.
|
||||
pub(super) fn move_to_drained(&mut self, error: Option<ConnectionError>) {
|
||||
@@ -93,6 +98,7 @@ impl State {
|
||||
(error, self.is_local_close())
|
||||
};
|
||||
self.inner = InnerState::Drained { error, is_local };
|
||||
trace!("connection state: drained");
|
||||
}
|
||||
|
||||
/// Moves to a draining state.
|
||||
@@ -109,6 +115,7 @@ impl State {
|
||||
);
|
||||
let is_local = self.is_local_close();
|
||||
self.inner = InnerState::Draining { error, is_local };
|
||||
trace!("connection state: draining");
|
||||
}
|
||||
|
||||
fn is_local_close(&self) -> bool {
|
||||
@@ -138,6 +145,7 @@ impl State {
|
||||
remote_reason: reason.into(),
|
||||
is_local: false,
|
||||
};
|
||||
trace!("connection state: closed");
|
||||
}
|
||||
|
||||
/// Moves to a closed state after a local error.
|
||||
@@ -157,6 +165,7 @@ impl State {
|
||||
remote_reason: reason.into(),
|
||||
is_local: true,
|
||||
};
|
||||
trace!("connection state: closed");
|
||||
}
|
||||
|
||||
pub(super) fn is_handshake(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user