ssh: fixed socks proxy connection race condition - fixes #5093, fixes #5060, fixes #5632

This commit is contained in:
Eugene Pankov
2022-01-29 15:26:26 +01:00
parent 3e8e3f7ccd
commit 02a3a8200b

View File

@@ -74,7 +74,9 @@ export class SocksProxyStream extends Duplex {
}, s => {
resolve(s)
this.header = s.read()
this.push(this.header)
if (this.header) {
this.push(this.header)
}
})
connector.on('error', (err) => {
reject(err)
@@ -82,7 +84,7 @@ export class SocksProxyStream extends Duplex {
})
})
this.client?.on('data', data => {
if (data !== this.header) {
if (!this.header || data !== this.header) {
// socksv5 doesn't reliably emit the first data event
this.push(data)
this.header = null