From 661fd6b55805d5382a139f1ec4db3eb4734ee941 Mon Sep 17 00:00:00 2001 From: Andrey Pechkurov Date: Sat, 8 Feb 2020 14:11:42 +0300 Subject: [PATCH] doc,test: add server.timeout property to http2 public API Both http and https modules have server.timeout property in public API. This commit adds documentation section and test for server.timeout in http2 module, so it becomes consistent with http and https. Also improves description of callback argument in documentation for server.setTimeout(). --- doc/api/http2.md | 42 ++++++++++++++++++++-- test/parallel/test-http2-server-timeout.js | 6 +++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index e022b39f044d53..396941c49ec5cb 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1797,9 +1797,28 @@ on the `Http2Server` after `msecs` milliseconds. The given callback is registered as a listener on the `'timeout'` event. -In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK` +In case if `callback` is not a function, a new `ERR_INVALID_CALLBACK` error will be thrown. +#### `server.timeout` + + +* {number} Timeout in milliseconds. **Default:** 0 (no timeout) + +The number of milliseconds of inactivity before a socket is presumed +to have timed out. + +A value of `0` will disable the timeout behavior on incoming connections. + +The socket timeout logic is set up on connection, so changing this +value only affects new connections to the server, not any existing connections. + ### Class: `Http2SecureServer` + +* {number} Timeout in milliseconds. **Default:** 0 (no timeout) + +The number of milliseconds of inactivity before a socket is presumed +to have timed out. + +A value of `0` will disable the timeout behavior on incoming connections. + +The socket timeout logic is set up on connection, so changing this +value only affects new connections to the server, not any existing connections. + ### `http2.createServer(options[, onRequestHandler])`