Skip to content

Commit

Permalink
add listener for secureConnect, per #2743 (#2828)
Browse files Browse the repository at this point in the history
maybe a fix for #2743, cant hurt, needs further investigation
  • Loading branch information
msimerson authored Aug 20, 2020
1 parent 38c58bc commit 99cb9f9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tls_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class pluggableStream extends stream.Stream {
self.targetsocket.on('connect', (a, b) => {
self.emit('connect', a, b);
});
self.targetsocket.on('secureConnect', (a, b) => {
self.emit('secureConnect', a, b);
self.emit('secure', a, b);
});
self.targetsocket.on('secureConnection', (a, b) => {
// investigate this for removal, see #2743
self.emit('secureConnection', a, b);
self.emit('secure', a, b);
});
Expand Down Expand Up @@ -95,16 +100,13 @@ class pluggableStream extends stream.Stream {
self.remoteAddress = self.targetsocket.remoteAddress;
}
}

clean (data) {
if (this.targetsocket && this.targetsocket.removeAllListeners) {
this.targetsocket.removeAllListeners('data');
this.targetsocket.removeAllListeners('secureConnection');
this.targetsocket.removeAllListeners('secure');
this.targetsocket.removeAllListeners('end');
this.targetsocket.removeAllListeners('close');
this.targetsocket.removeAllListeners('error');
this.targetsocket.removeAllListeners('drain');
[ 'data', 'secure', 'secureConnect', 'secureConnection',
'end', 'close', 'error', 'drain'
].forEach((name) => {
this.targetsocket.removeAllListeners(name);
})
}
this.targetsocket = {};
this.targetsocket.write = () => {};
Expand Down

0 comments on commit 99cb9f9

Please sign in to comment.