Skip to content

Commit fc2f84a

Browse files
committed
Check if socket is already connected in _openSocket(). Fixes webtorrent/webtorrent#1245.
1 parent 5b9da4a commit fc2f84a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/client/websocket-tracker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ class WebSocketTracker extends Tracker {
172172
this.socket = socketPool[this.announceUrl]
173173
if (this.socket) {
174174
socketPool[this.announceUrl].consumers += 1
175+
if (this.socket.connected) {
176+
this._onSocketConnectBound()
177+
}
175178
} else {
176179
this.socket = socketPool[this.announceUrl] = new Socket(this.announceUrl)
177180
this.socket.consumers = 1

0 commit comments

Comments
 (0)