Skip to content

Commit

Permalink
feat(qlog): log version_information on client (mozilla#1505)
Browse files Browse the repository at this point in the history
* deps(qlog): update to qlog v0.10.0

This commit upgrades all `neqo-*` crates to use `qlog` `v0.10.0`.

See also `qlog` `v0.10.0` release pull request cloudflare/quiche#1647

* feat(qlog): log version_information on client

This commit adds support for the qlog [`version_information` QUIC
event](https://quicwg.org/qlog/draft-ietf-quic-qlog-quic-events.html#name-version_information)
on the client.

Depends on mozilla#1504

Depends on cloudflare/quiche#1684

Meta issue: mozilla#528

* Use replace github.com/cloudflare with github.com/mxinden

With cloudflare/quiche#1684 merged, one can use
cloudflare's repo.

* Inline ev_data

* Remove crates.io patch

Patch no longer needed since upgrade to neqo v0.11.0 mozilla#1547.
  • Loading branch information
mxinden authored Jan 11, 2024
1 parent 5c11d26 commit abf2636
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
7 changes: 7 additions & 0 deletions neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,12 @@ impl Connection {
.get_versions_mut()
.set_initial(self.conn_params.get_versions().initial());
mem::swap(self, &mut c);
qlog::client_version_information_negotiated(
&mut self.qlog,
self.conn_params.get_versions().all(),
supported,
version,
);
Ok(())
} else {
qinfo!([self], "Version negotiation: failed with {:?}", supported);
Expand Down Expand Up @@ -2296,6 +2302,7 @@ impl Connection {
qinfo!([self], "client_start");
debug_assert_eq!(self.role, Role::Client);
qlog::client_connection_started(&mut self.qlog, &self.paths.primary());
qlog::client_version_information_initiated(&mut self.qlog, self.conn_params.get_versions());

self.handshake(now, self.version, PacketNumberSpace::Initial, None)?;
self.set_state(State::WaitInitial);
Expand Down
39 changes: 38 additions & 1 deletion neqo-transport/src/qlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use qlog::events::{
connectivity::{ConnectionStarted, ConnectionState, ConnectionStateUpdated},
quic::{
AckedRanges, ErrorSpace, MetricsUpdated, PacketDropped, PacketHeader, PacketLost,
PacketReceived, PacketSent, QuicFrame, StreamType,
PacketReceived, PacketSent, QuicFrame, StreamType, VersionInformation,
},
Event, EventData, RawInfo,
};
Expand All @@ -33,6 +33,7 @@ use crate::{
stream_id::StreamType as NeqoStreamType,
tparams::{self, TransportParametersHandler},
tracking::SentPacket,
version::{Version, VersionConfig, WireVersion},
};

pub fn connection_tparams_set(qlog: &mut NeqoQlog, tph: &TransportParametersHandler) {
Expand Down Expand Up @@ -127,6 +128,42 @@ pub fn connection_state_updated(qlog: &mut NeqoQlog, new: &State) {
});
}

pub fn client_version_information_initiated(qlog: &mut NeqoQlog, version_config: &VersionConfig) {
qlog.add_event_data(|| {
Some(EventData::VersionInformation(VersionInformation {
client_versions: Some(
version_config
.all()
.iter()
.map(|v| format!("{:02x}", v.wire_version()))
.collect(),
),
server_versions: None,
chosen_version: Some(format!("{:02x}", version_config.initial().wire_version())),
}))
});
}

pub fn client_version_information_negotiated(
qlog: &mut NeqoQlog,
client: &[Version],
server: &[WireVersion],
chosen: Version,
) {
qlog.add_event_data(|| {
Some(EventData::VersionInformation(VersionInformation {
client_versions: Some(
client
.iter()
.map(|v| format!("{:02x}", v.wire_version()))
.collect(),
),
server_versions: Some(server.iter().map(|v| format!("{v:02x}")).collect()),
chosen_version: Some(format!("{:02x}", chosen.wire_version())),
}))
});
}

pub fn packet_sent(
qlog: &mut NeqoQlog,
pt: PacketType,
Expand Down

0 comments on commit abf2636

Please sign in to comment.