mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 08:53:29 +00:00
Introduce somaxconn to restrict backlog
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
dee0956921
commit
994f3727d8
@ -23,8 +23,11 @@ impl ListenStream {
|
|||||||
bound_socket: AnyBoundSocket,
|
bound_socket: AnyBoundSocket,
|
||||||
backlog: usize,
|
backlog: usize,
|
||||||
) -> core::result::Result<Self, (Error, AnyBoundSocket)> {
|
) -> core::result::Result<Self, (Error, AnyBoundSocket)> {
|
||||||
|
const SOMAXCONN: usize = 4096;
|
||||||
|
let somaxconn = SOMAXCONN.min(backlog);
|
||||||
|
|
||||||
let listen_stream = Self {
|
let listen_stream = Self {
|
||||||
backlog,
|
backlog: somaxconn,
|
||||||
bound_socket,
|
bound_socket,
|
||||||
backlog_sockets: RwLock::new(Vec::new()),
|
backlog_sockets: RwLock::new(Vec::new()),
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user