Skip to content

Commit 81edd1a

Browse files
authored
Merge pull request #312 from lpinca/support/nodejs-8
fix: support for Node.js 4 and above
2 parents 651ce41 + d2fe97d commit 81edd1a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/spdy/server.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ proto._onStream = function _onStream (stream) {
189189
socket = new net.Socket(socketOptions)
190190
}
191191

192+
// This is needed because the `error` listener, added by the default
193+
// `connection` listener, no longer has bound arguments. It relies instead
194+
// on the `server` property of the socket. See https://github.com/nodejs/node/pull/11926
195+
// for more details.
196+
// This is only done for Node.js >= 4 in order to not break compatibility
197+
// with older versions of the platform.
198+
if (process.versions.modules >= 46) { socket.server = this }
199+
192200
handle.assignSocket(socket)
193201

194202
// For v0.8

0 commit comments

Comments
 (0)