mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-23 19:48:19 +00:00
Move function may_fragment() from lib quinn-udp to UdpSocketState.
This commit is contained in:
committed by
Dirkjan Ochtman
parent
4f25f501ef
commit
7b72b71c2f
@@ -32,14 +32,6 @@ mod imp;
|
||||
|
||||
pub use imp::UdpSocketState;
|
||||
|
||||
/// Whether transmitted datagrams might get fragmented by the IP layer
|
||||
///
|
||||
/// Returns `false` on targets which employ e.g. the `IPV6_DONTFRAG` socket option.
|
||||
#[inline]
|
||||
pub fn may_fragment() -> bool {
|
||||
imp::may_fragment()
|
||||
}
|
||||
|
||||
/// Number of UDP packets to send/receive at a time
|
||||
pub const BATCH_SIZE: usize = imp::BATCH_SIZE;
|
||||
|
||||
|
||||
@@ -165,6 +165,14 @@ impl UdpSocketState {
|
||||
self.gro_segments
|
||||
}
|
||||
|
||||
/// Whether transmitted datagrams might get fragmented by the IP layer
|
||||
///
|
||||
/// Returns `false` on targets which employ e.g. the `IPV6_DONTFRAG` socket option.
|
||||
#[inline]
|
||||
pub fn may_fragment(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Returns true if we previously got an EINVAL error from `sendmsg` or `sendmmsg` syscall.
|
||||
fn sendmsg_einval(&self) -> bool {
|
||||
self.sendmsg_einval.load(Ordering::Relaxed)
|
||||
@@ -713,11 +721,6 @@ pub(crate) const BATCH_SIZE: usize = 32;
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
pub(crate) const BATCH_SIZE: usize = 1;
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn may_fragment() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
mod gso {
|
||||
use super::*;
|
||||
|
||||
@@ -147,11 +147,11 @@ impl UdpSocketState {
|
||||
pub fn gro_segments(&self) -> usize {
|
||||
1
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn may_fragment(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) const BATCH_SIZE: usize = 1;
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn may_fragment() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ impl AsyncUdpSocket for UdpSocket {
|
||||
}
|
||||
|
||||
fn may_fragment(&self) -> bool {
|
||||
udp::may_fragment()
|
||||
self.inner.may_fragment()
|
||||
}
|
||||
|
||||
fn max_transmit_segments(&self) -> usize {
|
||||
|
||||
@@ -83,7 +83,7 @@ impl AsyncUdpSocket for UdpSocket {
|
||||
}
|
||||
|
||||
fn may_fragment(&self) -> bool {
|
||||
udp::may_fragment()
|
||||
self.inner.may_fragment()
|
||||
}
|
||||
|
||||
fn max_transmit_segments(&self) -> usize {
|
||||
|
||||
Reference in New Issue
Block a user