Skip to content

Conversation

@bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Aug 27, 2025

This commit adds tcpBacklog argument to Deno.listen, Deno.listenTls and Deno.serve APIs.

The argument specifies maximum number of pending connections in the listen queue, and
by default is set to 511. Users that expect huge bursts of traffic can customize this
option to a higher value.

Ref #30471
Closes #30388

@bartlomieju bartlomieju changed the title feat: Add backlog arg to Deno.listen{Tls} and Deno.serve feat: Add tcpBacklog arg to Deno.listen{Tls} and Deno.serve Aug 27, 2025
#[serde] addr: IpAddr,
reuse_port: bool,
load_balanced: bool,
tcp_backlog: i32,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i32? What happens when this is negative?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For whatever reason, the libc function itself takes a signed int https://man7.org/linux/man-pages/man2/listen.2.html. As far as I can tell, negative values usually just act like you passed 0.

@dsherret dsherret changed the title feat: Add tcpBacklog arg to Deno.listen{Tls} and Deno.serve feat: add tcpBacklog arg to Deno.listen{Tls} and Deno.serve Aug 27, 2025
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit da1bf97 into denoland:main Aug 28, 2025
36 of 37 checks passed
@bartlomieju bartlomieju deleted the backlog_arg branch August 28, 2025 07:43
bartlomieju added a commit that referenced this pull request Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backlog parameter on Deno.serve

3 participants