From 77e5b509a90b3e72865fc0787a6c7673683d0313 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(). PR-URL: https://github.com/nodejs/node/pull/31693 Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- doc/api/http2.md | 42 ++++++++++++++++++++-- test/parallel/test-http2-server-timeout.js | 34 ++++++++++-------- 2 files changed, 60 insertions(+), 16 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 69252121f71daf..0e7d47e14fdcec 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])`