mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 00:43:24 +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,
|
||||
backlog: usize,
|
||||
) -> core::result::Result<Self, (Error, AnyBoundSocket)> {
|
||||
const SOMAXCONN: usize = 4096;
|
||||
let somaxconn = SOMAXCONN.min(backlog);
|
||||
|
||||
let listen_stream = Self {
|
||||
backlog,
|
||||
backlog: somaxconn,
|
||||
bound_socket,
|
||||
backlog_sockets: RwLock::new(Vec::new()),
|
||||
};
|
||||
|
Reference in New Issue
Block a user