pub struct TunnelStats {
pub forwards_served: AtomicU64,
pub capacity_waits: AtomicU64,
pub effective_port: AtomicU32,
pub stopped_by_signal: AtomicBool,
pub stopped_by_accept_error: AtomicBool,
}Expand description
Counters shared between the accept loop and the deadline wrapper.
These deliberately live outside the future passed to tokio::time::timeout.
On the deadline path — the most common ending — that future is dropped mid-poll and
never reaches its own tail, so anything owned by it would be lost exactly when the
shutdown event matters most. Holding the counters in an Arc the wrapper also owns
lets tunnel_closed be emitted on every ending.
Fields§
§forwards_served: AtomicU64Connections accepted and handed to a forward task.
capacity_waits: AtomicU64Times a connection waited for a concurrency permit.
effective_port: AtomicU32OS-assigned local port after bind (0 until the listener is up).
stopped_by_signal: AtomicBoolSet when the accept loop stopped because of a signal.
stopped_by_accept_error: AtomicBoolSet when the accept loop stopped because of a fatal accept error.
Implementations§
Source§impl TunnelStats
impl TunnelStats
Sourcepub fn close_reason(&self) -> TunnelCloseReason
pub fn close_reason(&self) -> TunnelCloseReason
Resolves the close reason from the flags the loop managed to set.
Defaults to crate::json_wire::TunnelCloseReason::Deadline: if neither flag is
set the loop was still serving when it was cancelled, which is precisely the
deadline ending.