Skip to content

Commit 86a79a7

Browse files
tokio-quiche: command to update ConnectionStats (#2283)
1 parent 225b656 commit 86a79a7

File tree

1 file changed

+11
-0
lines changed
  • tokio-quiche/src/quic/connection

1 file changed

+11
-0
lines changed

tokio-quiche/src/quic/connection/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,11 @@ pub enum QuicCommand {
787787
/// Unlike [`QuicConnection::stats()`], these statistics are not cached and
788788
/// instead are retrieved right before the command is executed.
789789
Stats(Box<dyn FnOnce(datagram_socket::SocketStats) + Send + 'static>),
790+
/// Collect the current [`QuicConnectionStats`] from the connection.
791+
///
792+
/// These statistics are not cached and instead are retrieved right before
793+
/// the command is executed.
794+
ConnectionStats(Box<dyn FnOnce(QuicConnectionStats) + Send + 'static>),
790795
}
791796

792797
impl QuicCommand {
@@ -812,6 +817,10 @@ impl QuicCommand {
812817
let stats_pair = QuicConnectionStats::from_conn(qconn);
813818
(callback)(stats_pair.as_socket_stats());
814819
},
820+
Self::ConnectionStats(callback) => {
821+
let stats_pair = QuicConnectionStats::from_conn(qconn);
822+
(callback)(stats_pair);
823+
},
815824
}
816825
}
817826
}
@@ -823,6 +832,8 @@ impl fmt::Debug for QuicCommand {
823832
f.debug_tuple("ConnectionClose").field(b).finish(),
824833
Self::Custom(_) => f.debug_tuple("Custom").finish_non_exhaustive(),
825834
Self::Stats(_) => f.debug_tuple("Stats").finish_non_exhaustive(),
835+
Self::ConnectionStats(_) =>
836+
f.debug_tuple("ConnectionStats").finish_non_exhaustive(),
826837
}
827838
}
828839
}

0 commit comments

Comments
 (0)