| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 15df4ed commit 41100b6
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1034,7 +1034,7 @@ function setupHandle(socket, type, options) { | |||
| 1034 | 1034 | // If the session has been destroyed, go ahead and emit 'connect', | |
| 1035 | 1035 | // but do nothing else. The various on('connect') handlers set by | |
| 1036 | 1036 | // core will check for session.destroyed before progressing, this | |
| 1037 | - // ensures that those at l`east get cleared out. | ||
| 1037 | + // ensures that those at least get cleared out. | ||
| 1038 | 1038 | if (this.destroyed) { | |
| 1039 | 1039 | process.nextTick(emit, this, 'connect', this, socket); | |
| 1040 | 1040 | return; | |
@@ -2126,7 +2126,7 @@ class Http2Stream extends Duplex { | |||
| 2126 | 2126 | } | |
| 2127 | 2127 | ||
| 2128 | 2128 | [kProceed]() { | |
| 2129 | - assert.fail('Implementors MUST implement this. Please report this as a ' + | ||
| 2129 | + assert.fail('Implementers MUST implement this. Please report this as a ' + | ||
| 2130 | 2130 | 'bug in Node.js'); | |
| 2131 | 2131 | } | |
| 2132 | 2132 | ||
@@ -3380,8 +3380,13 @@ function connect(authority, options, listener) { | |||
| 3380 | 3380 | ObjectDefineProperty(connect, promisify.custom, { | |
| 3381 | 3381 | __proto__: null, | |
| 3382 | 3382 | value: (authority, options) => { | |
| 3383 | - return new Promise((resolve) => { | ||
| 3384 | - const server = connect(authority, options, () => resolve(server)); | ||
| 3383 | + return new Promise((resolve, reject) => { | ||
| 3384 | + const server = connect(authority, options, () => { | ||
| 3385 | + server.removeListener('error', reject); | ||
| 3386 | + return resolve(server); | ||
| 3387 | + }); | ||
| 3388 | + | ||
| 3389 | + server.once('error', reject); | ||
| 3385 | 3390 | }); | |
| 3386 | 3391 | }, | |
| 3387 | 3392 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + | ||
| 5 | + if (!common.hasCrypto) | ||
| 6 | + common.skip('missing crypto'); | ||
| 7 | + const assert = require('assert'); | ||
| 8 | + const http2 = require('http2'); | ||
| 9 | + const util = require('util'); | ||
| 10 | + | ||
| 11 | + const server = http2.createServer(); | ||
| 12 | + | ||
| 13 | + server.listen(0, common.mustCall(() => { | ||
| 14 | + const port = server.address().port; | ||
| 15 | + server.close(() => { | ||
| 16 | + const connect = util.promisify(http2.connect); | ||
| 17 | + connect(`http://localhost:${port}`) | ||
| 18 | + .then(common.mustNotCall('Promise should not be resolved')) | ||
| 19 | + .catch(common.mustCall((err) => { | ||
| 20 | + assert(err instanceof Error); | ||
| 21 | + assert.strictEqual(err.code, 'ECONNREFUSED'); | ||
| 22 | + })); | ||
| 23 | + }); | ||
| 24 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments