feat: add tcpBacklog arg to Deno.listen{Tls} and Deno.serve (#30541)

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 https://github.com/denoland/deno/pull/30471
Closes https://github.com/denoland/deno/issues/30388
This commit is contained in:
Bartek Iwańczuk 2025-08-28 09:43:20 +02:00 committed by GitHub
parent 9dbcd025d6
commit da1bf978f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 49 additions and 15 deletions

View file

@ -5157,6 +5157,18 @@ declare namespace Deno {
/** Sets `SO_REUSEPORT` on POSIX systems. */
reusePort?: boolean;
/** Maximum number of pending connections in the listen queue.
*
* This parameter controls how many incoming connections can be queued by the
* operating system while waiting for the application to accept them. If more
* connections arrive when the queue is full, they will be refused.
*
* The kernel may adjust this value (e.g., rounding up to the next power of 2
* plus 1). Different operating systems have different maximum limits.
*
* @default {511} */
tcpBacklog?: number;
}
/**

View file

@ -191,6 +191,18 @@ declare namespace Deno {
*
* @default {"0.0.0.0"} */
hostname?: string;
/** Maximum number of pending connections in the listen queue.
*
* This parameter controls how many incoming connections can be queued by the
* operating system while waiting for the application to accept them. If more
* connections arrive when the queue is full, they will be refused.
*
* The kernel may adjust this value (e.g., rounding up to the next power of 2
* plus 1). Different operating systems have different maximum limits.
*
* @default {511} */
tcpBacklog?: number;
}
/** @category Network */