Skip to content

Commit b58713f

Browse files
committed
fixup
1 parent 7d3cf5b commit b58713f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

examples/proxy/proxy.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ class HTTPHandler {
6868
}
6969

7070
onError (err) {
71-
this.res
72-
.off('drain', this.resume)
73-
.off('close', this.abort)
71+
this.res.off('close', this.abort)
72+
this.res.off('drain', this.resume)
7473
this.callback(err)
7574
}
7675
}
@@ -83,6 +82,7 @@ class WSHandler {
8382

8483
this.socket = socket
8584
this.head = head
85+
this.abort = null
8686
this.promise = new Promise((resolve, reject) => {
8787
this.callback = err => err ? reject(err) : resolve()
8888
})
@@ -92,6 +92,7 @@ class WSHandler {
9292
if (this.socket.destroyed) {
9393
abort()
9494
} else {
95+
this.abort = abort
9596
this.socket.on('close', abort)
9697
}
9798
}
@@ -127,6 +128,7 @@ class WSHandler {
127128
}
128129

129130
onError (err) {
131+
this.socket.off('close', this.abort)
130132
this.callback(err)
131133
}
132134
}

0 commit comments

Comments
 (0)