mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Set keepalive and tcp_nodelay on underlying sockets
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
8b07a68e9e
commit
58cf8ea681
@ -1,6 +1,9 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use aster_bigtcp::{socket::UnboundTcpSocket, wire::IpEndpoint};
|
||||
use aster_bigtcp::{
|
||||
socket::{RawTcpSetOption, UnboundTcpSocket},
|
||||
wire::IpEndpoint,
|
||||
};
|
||||
|
||||
use super::{connecting::ConnectingStream, listen::ListenStream, StreamObserver};
|
||||
use crate::{
|
||||
@ -108,4 +111,14 @@ impl InitStream {
|
||||
// Linux adds OUT and HUP events for a newly created socket
|
||||
IoEvents::OUT | IoEvents::HUP
|
||||
}
|
||||
|
||||
pub(super) fn set_raw_option<R>(
|
||||
&mut self,
|
||||
set_option: impl Fn(&mut dyn RawTcpSetOption) -> R,
|
||||
) -> R {
|
||||
match self {
|
||||
InitStream::Unbound(unbound_socket) => set_option(unbound_socket.as_mut()),
|
||||
InitStream::Bound(bound_socket) => set_option(bound_socket),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user