mirror of
https://github.com/nestjs/nest.git
synced 2026-10-28 09:45:43 +08:00
A packet's declared length was never compared against "maxBufferSize", so a packet that could never be accepted was still buffered until the buffer filled up. It is now rejected as soon as its length is read, and the connection is dropped, since everything that follows is the rest of that packet. The idle timer for a partially received packet is refreshed on every read, so a peer that sends a few bytes now and then kept a partial packet buffered for as long as it liked. The new "messageReceiveTimeout" option (default: 300000ms, like "requestTimeout" in node:http) bounds the time from a packet's first character to its last, and is not extended by further reads. Time spent with reading suspended due to backpressure is not counted. Set it to 0 to disable it. Also corrects the comment on the default "maxBufferSize": it is counted in characters, which take 1 or 2 bytes each, not 4.