Skip to content

Commit

Permalink
Added Alloc cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
maddeleine committed Mar 3, 2025
1 parent 765c094 commit a8d3ee4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions quic/s2n-quic-core/src/connection/limits.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#[cfg(feature = "alloc")]
use crate::application::ServerName;
use crate::{
ack,
application::ServerName,
event::{api::SocketAddress, IntoEvent},
inet, recovery, stream,
transport::parameters::{
Expand All @@ -13,6 +13,7 @@ use crate::{
MaxDatagramFrameSize, MaxIdleTimeout, MigrationSupport, TransportParameters,
},
};
#[cfg(feature = "alloc")]
use bytes::Bytes;
use core::time::Duration;
use s2n_codec::decoder_invariant;
Expand Down Expand Up @@ -57,12 +58,14 @@ impl<'a> ConnectionInfo<'a> {

#[non_exhaustive]
#[derive(Debug)]
#[cfg(feature = "alloc")]
pub struct HandshakeInfo<'a> {
pub remote_address: SocketAddress<'a>,
pub server_name: Option<&'a ServerName>,
pub application_protocol: &'a Bytes,
}

#[cfg(feature = "alloc")]
impl<'a> HandshakeInfo<'a> {
pub fn new(
remote_address: &'a inet::SocketAddress,
Expand Down Expand Up @@ -442,6 +445,7 @@ pub trait Limiter: 'static + Send {
/// Provides another opportunity to change connection limits with information
/// from the handshake
#[inline]
#[cfg(feature = "alloc")]
fn on_post_handshake(&mut self, info: &HandshakeInfo, limits: &mut UpdatableLimits) {
let _ = info;
let _ = limits;
Expand All @@ -453,7 +457,7 @@ impl Limiter for Limits {
fn on_connection(&mut self, _into: &ConnectionInfo) -> Limits {
*self
}

#[cfg(feature = "alloc")]
fn on_post_handshake(&mut self, _info: &HandshakeInfo, _limits: &mut UpdatableLimits) {}
}

Expand Down

0 comments on commit a8d3ee4

Please sign in to comment.