Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sterlingdeng committed Sep 19, 2024
1 parent c98b93f commit 3fd8f2e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
44 changes: 35 additions & 9 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,10 @@ impl Connection {
if side.is_client() {
// Kick off the connection
this.write_crypto();
this.init_0rtt(now);
this.init_0rtt(
#[cfg(feature = "acktimestamps")]
now,
);
}
this
}
Expand Down Expand Up @@ -2079,7 +2082,7 @@ impl Connection {
Ok(())
}

fn init_0rtt(&mut self, now: Instant) {
fn init_0rtt(&mut self, #[cfg(feature = "acktimestamps")] now: Instant) {
let (header, packet) = match self.crypto.early_crypto() {
Some(x) => x,
None => return,
Expand All @@ -2101,7 +2104,11 @@ impl Connection {
max_ack_delay: TransportParameters::default().max_ack_delay,
..params
};
self.set_peer_params(params, now);
self.set_peer_params(
params,
#[cfg(feature = "acktimestamps")]
now,
);
}
Err(e) => {
error!("session ticket has malformed transport parameters: {}", e);
Expand Down Expand Up @@ -2622,7 +2629,11 @@ impl Connection {
self.endpoint_events
.push_back(EndpointEventInner::ResetToken(self.path.remote, token));
}
self.handle_peer_params(params, now)?;
self.handle_peer_params(
params,
#[cfg(feature = "acktimestamps")]
now,
)?;
self.issue_first_cids(now);
} else {
// Server-only
Expand Down Expand Up @@ -2669,9 +2680,16 @@ impl Connection {
frame: None,
reason: "transport parameters missing".into(),
})?;
self.handle_peer_params(params, now)?;
self.handle_peer_params(
params,
#[cfg(feature = "acktimestamps")]
now,
)?;
self.issue_first_cids(now);
self.init_0rtt(now);
self.init_0rtt(
#[cfg(feature = "acktimestamps")]
now,
);
}
Ok(())
}
Expand Down Expand Up @@ -3481,7 +3499,7 @@ impl Connection {
fn handle_peer_params(
&mut self,
params: TransportParameters,
now: Instant,
#[cfg(feature = "acktimestamps")] now: Instant,
) -> Result<(), TransportError> {
if Some(self.orig_rem_cid) != params.initial_src_cid
|| (self.side.is_client()
Expand All @@ -3493,12 +3511,20 @@ impl Connection {
));
}

self.set_peer_params(params, now);
self.set_peer_params(
params,
#[cfg(feature = "acktimestamps")]
now,
);

Ok(())
}

fn set_peer_params(&mut self, params: TransportParameters, now: Instant) {
fn set_peer_params(
&mut self,
params: TransportParameters,
#[cfg(feature = "acktimestamps")] now: Instant,
) {
self.streams.set_params(&params);
self.idle_timeout = match (self.config.max_idle_timeout, params.max_idle_timeout) {
(None, VarInt(0)) => None,
Expand Down
2 changes: 0 additions & 2 deletions quinn-proto/src/connection/spaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,11 @@ impl PendingAcks {
&self.ranges
}


#[cfg(feature = "acktimestamps")]
pub(super) fn receiver_timestamps_as_mut(&mut self) -> Option<&mut ReceiverTimestamps> {
self.receiver_timestamps.as_mut()
}


#[cfg(feature = "acktimestamps")]
pub(super) fn receiver_timestamps_as_ref(&self) -> Option<&ReceiverTimestamps> {
self.receiver_timestamps.as_ref()
Expand Down

0 comments on commit 3fd8f2e

Please sign in to comment.