| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 29643cc commit b54452d
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -734,7 +734,7 @@ function setupHandle(socket, type, options) { | |||
| 734 | 734 | // core will check for session.destroyed before progressing, this | |
| 735 | 735 | // ensures that those at l`east get cleared out. | |
| 736 | 736 | if (this.destroyed) { | |
| 737 | - this.emit('connect', this, socket); | ||
| 737 | + process.nextTick(emit, this, 'connect', this, socket); | ||
| 738 | 738 | return; | |
| 739 | 739 | } | |
| 740 | 740 | debug(`Http2Session ${sessionName(type)}: setting up session handle`); | |
@@ -776,7 +776,7 @@ function setupHandle(socket, type, options) { | |||
| 776 | 776 | options.settings : {}; | |
| 777 | 777 | ||
| 778 | 778 | this.settings(settings); | |
| 779 | - this.emit('connect', this, socket); | ||
| 779 | + process.nextTick(emit, this, 'connect', this, socket); | ||
| 780 | 780 | } | |
| 781 | 781 | ||
| 782 | 782 | // Emits a close event followed by an error event if err is truthy. Used | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,9 @@ if (!hasCrypto) | |||
| 5 | 5 | skip('missing crypto'); | |
| 6 | 6 | const { doesNotThrow, throws } = require('assert'); | |
| 7 | 7 | const { createServer, connect } = require('http2'); | |
| 8 | + const { connect: netConnect } = require('net'); | ||
| 9 | + | ||
| 10 | + // check for session connect callback and event | ||
| 8 | 11 | { | |
| 9 | 12 | const server = createServer(); | |
| 10 | 13 | server.listen(0, mustCall(() => { | |
@@ -30,6 +33,28 @@ const { createServer, connect } = require('http2'); | |||
| 30 | 33 | })); | |
| 31 | 34 | } | |
| 32 | 35 | ||
| 36 | + // check for session connect callback on already connected socket | ||
| 37 | + { | ||
| 38 | + const server = createServer(); | ||
| 39 | + server.listen(0, mustCall(() => { | ||
| 40 | + const { port } = server.address(); | ||
| 41 | + | ||
| 42 | + const onSocketConnect = () => { | ||
| 43 | + const authority = `http://localhost:${port}`; | ||
| 44 | + const createConnection = mustCall(() => socket); | ||
| 45 | + const options = { createConnection }; | ||
| 46 | + connect(authority, options, mustCall(onSessionConnect)); | ||
| 47 | + }; | ||
| 48 | + | ||
| 49 | + const onSessionConnect = (session) => { | ||
| 50 | + session.close(); | ||
| 51 | + server.close(); | ||
| 52 | + }; | ||
| 53 | + | ||
| 54 | + const socket = netConnect(port, mustCall(onSocketConnect)); | ||
| 55 | + })); | ||
| 56 | + } | ||
| 57 | + | ||
| 33 | 58 | // check for https as protocol | |
| 34 | 59 | { | |
| 35 | 60 | const authority = 'https://localhost'; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments