Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2017-10-19 02:07:41 +0300
committerMyles Borins <mylesborins@google.com>2017-10-24 00:35:50 +0300
commitbc1ad81b4c478dea765086010d49d9d982e473be (patch)
tree5e15a56d4dca88d123d1ea64ca02eae5fb1cc7a6 /lib
parentbcb83f70ec905b6a9884bd14e5783d547efe4113 (diff)
http2: small fixes to http2 core
A few small changes: - fix debug statement location - simplify conditional with returns - consistent use of template strings PR-URL: https://github.com/nodejs/node/pull/16327 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/http2/core.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index d71aa485b1d..a192e6047f6 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -881,14 +881,14 @@ class Http2Session extends EventEmitter {
// A stream cannot be made to depend on itself
if (options.parent === id) {
- debug(`[${sessionName(this[kType])}] session still connecting. queue ` +
- 'priority');
throw new errors.TypeError('ERR_INVALID_OPT_VALUE',
'parent',
options.parent);
}
if (id === undefined) {
+ debug(`[${sessionName(this[kType])}] session still connecting. queue ` +
+ 'priority');
stream.once('ready', submitPriority.bind(this, stream, options));
return;
}
@@ -1203,7 +1203,7 @@ function streamOnResume() {
if (session && !state.reading) {
state.reading = true;
assert(session[kHandle].streamReadStart(this[kID]) === undefined,
- 'HTTP/2 Stream #{this[kID]} does not exist. Please report this as ' +
+ `HTTP/2 Stream ${this[kID]} does not exist. Please report this as ` +
'a bug in Node.js');
}
}
@@ -1411,7 +1411,7 @@ class Http2Stream extends Duplex {
return;
state.reading = true;
assert(this[kSession][kHandle].streamReadStart(this[kID]) === undefined,
- 'HTTP/2 Stream #{this[kID]} does not exist. Please report this as ' +
+ `HTTP/2 Stream ${this[kID]} does not exist. Please report this as ` +
'a bug in Node.js');
}
@@ -2264,16 +2264,14 @@ function connectionListener(socket) {
const options = this[kOptions] || {};
if (socket.alpnProtocol === false || socket.alpnProtocol === 'http/1.1') {
- if (options.allowHTTP1 === true) {
- // Fallback to HTTP/1.1
+ // Fallback to HTTP/1.1
+ if (options.allowHTTP1 === true)
return httpConnectionListener.call(this, socket);
- } else if (this.emit('unknownProtocol', socket)) {
- // Let event handler deal with the socket
+ // Let event handler deal with the socket
+ if (this.emit('unknownProtocol', socket))
return;
- } else {
- // Reject non-HTTP/2 client
- return socket.destroy();
- }
+ // Reject non-HTTP/2 client
+ return socket.destroy();
}
socket.on('error', socketOnError);