sessionOptions.streamIdleTimeout
由对等方发起的流在空闲(未接收数据)状态下可存在的最大时间(毫秒),超过这个时间将被自动销毁。这可以防止类似慢速攻击(slowloris)——远程对等方打开流但从不发送数据,从而无限占用服务器资源。只有对等方发起的流会被检查,本地发起的流则由应用管理。设置为 0 可禁用该功能。
🌐 The maximum time in milliseconds that a peer-initiated stream can be idle
(no data received) before it is automatically destroyed. This protects
against slowloris-style attacks where a remote peer opens streams but never
sends data, holding server resources indefinitely. Only peer-initiated
streams are checked — locally-initiated streams are the application's
responsibility. Set to 0 to disable.
闲置检查作为正常发送处理循环的一部分运行,所以它不会增加额外的定时器或事件循环开销。session.stats.streamsIdleTimedOut 计数器跟踪有多少流被这个机制销毁了。
🌐 The idle check runs as part of the normal send processing loop, so it adds
no additional timers or event loop overhead. The
session.stats.streamsIdleTimedOut counter tracks how many streams have been
destroyed by this mechanism.