Merge pull request #332 from guanzo/bugfix

Check if socket is already connected in _openSocket().
This commit is contained in:
Feross Aboukhadijeh 2019-08-18 12:52:51 -07:00 committed by GitHub
commit 4196c26917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,6 +172,9 @@ class WebSocketTracker extends Tracker {
this.socket = socketPool[this.announceUrl]
if (this.socket) {
socketPool[this.announceUrl].consumers += 1
if (this.socket.connected) {
this._onSocketConnectBound()
}
} else {
this.socket = socketPool[this.announceUrl] = new Socket(this.announceUrl)
this.socket.consumers = 1