Move function may_fragment() from lib quinn-udp to UdpSocketState.

This commit is contained in:
JieLiang Ma
2023-08-14 19:18:32 +08:00
committed by Dirkjan Ochtman
parent 4f25f501ef
commit 7b72b71c2f
5 changed files with 15 additions and 20 deletions
-8
View File
@@ -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;
+8 -5
View File
@@ -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::*;
+5 -5
View File
@@ -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
}
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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 {