From 2b78a845ac2f93b0f4c9f9a3315afca71f646b0c Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 21 Sep 2018 15:36:27 -0700 Subject: [PATCH 1/3] http2: add Http2Session.lastReceivedTime Adds a time stamp indicating the last time data was received from the connected peer. Fixes: https://github.com/nodejs/node/issues/21730 --- doc/api/http2.md | 11 ++++++ lib/internal/http2/core.js | 4 +++ src/node_http2.cc | 11 ++++++ src/node_http2.h | 5 +++ .../test-http2-session-lastreceivedtime.js | 35 +++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 test/parallel/test-http2-session-lastreceivedtime.js diff --git a/doc/api/http2.md b/doc/api/http2.md index 205c0dc85b8102..70656c0716ef5b 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -411,6 +411,17 @@ added: v9.4.0 Transmits a `GOAWAY` frame to the connected peer *without* shutting down the `Http2Session`. +#### http2session.lastReceivedTime + + +* { double } + +A timestamp indicating the moment the most recently received communication of +any kind was received from the connected peer. A value of `0` indicates that +the session is still open but no data has yet been received. + #### http2session.localSettings -* { double } +* {number} A timestamp indicating the moment the most recently received communication of any kind was received from the connected peer. A value of `0` indicates that From bc5fd8e05536d2dcf6a8856aee287a0d705e6503 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sun, 23 Sep 2018 16:20:09 -0700 Subject: [PATCH 3/3] [Squash] use function instead --- doc/api/http2.md | 11 ++++++----- lib/internal/http2/core.js | 2 +- test/parallel/test-http2-session-lastreceivedtime.js | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index ea68a6147d6fb7..ab74b94528c81c 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -411,16 +411,17 @@ added: v9.4.0 Transmits a `GOAWAY` frame to the connected peer *without* shutting down the `Http2Session`. -#### http2session.lastReceivedTime +#### http2session.getLastReceivedTime() -* {number} +* Returns: {number} -A timestamp indicating the moment the most recently received communication of -any kind was received from the connected peer. A value of `0` indicates that -the session is still open but no data has yet been received. +Returns a timestamp indicating the moment the most recently received +communication of any kind was received from the connected peer. A value of `0` +indicates that the session is still open but no data has yet been received. +A value of `undefined` indicates that the session is no longer valid. #### http2session.localSettings