From cef909797af1d716b802f04264e51cf7f26c1b51 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 19 Mar 2018 09:17:23 -0700 Subject: [PATCH] http2: do not emit our own close emit in Http2Stream Streams were recently updated to emit their own close event. The Http2Stream was an exception because it included the close argument with the close event. Refactor that to use the built in close. PR-URL: https://github.com/nodejs/node/pull/19451 Reviewed-By: Matteo Collina --- doc/api/http2.md | 8 ++++---- lib/internal/http2/core.js | 3 --- .../test-http2-client-rststream-before-connect.js | 4 ++-- .../test-http2-client-stream-destroy-before-connect.js | 4 ++-- test/parallel/test-http2-options-max-reserved-streams.js | 4 ++-- test/parallel/test-http2-server-rst-before-respond.js | 4 ++-- test/parallel/test-http2-server-rst-stream.js | 4 ++-- test/parallel/test-http2-too-large-headers.js | 4 ++-- test/parallel/test-http2-too-many-headers.js | 4 ++-- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 484a681eae1..050ef5d0b22 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -335,7 +335,7 @@ Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`. Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` -is not undefined, an `'error'` event will be emitted immediately after the +is not undefined, an `'error'` event will be emitted immediately before the `'close'` event. If there are any remaining open `Http2Streams` associated with the @@ -816,9 +816,9 @@ added: v8.4.0 The `'close'` event is emitted when the `Http2Stream` is destroyed. Once this event is emitted, the `Http2Stream` instance is no longer usable. -The listener callback is passed a single argument specifying the HTTP/2 error -code specified when closing the stream. If the code is any value other than -`NGHTTP2_NO_ERROR` (`0`), an `'error'` event will also be emitted. +The HTTP/2 error code used when closing the stream can be retrieved using +the `http2stream.rstCode` property. If the code is any value other than +`NGHTTP2_NO_ERROR` (`0`), an `'error'` event will have also been emitted. #### Event: 'error'