mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 19:06:27 +00:00
always produce valid urls with trailing /
Fixes this error: ERROR: connection error to wss://tracker.webtorrent.io?1fe16837ed ERROR: If you think this is a bug in webtorrent, report it!
This commit is contained in:
parent
19ba81a989
commit
3be06d6684
@ -25,7 +25,11 @@ function WebSocketTracker (client, announceUrl, opts) {
|
|||||||
self.destroyed = false
|
self.destroyed = false
|
||||||
|
|
||||||
self._opts = opts
|
self._opts = opts
|
||||||
|
|
||||||
self._announceUrl = announceUrl
|
self._announceUrl = announceUrl
|
||||||
|
if (self._announceUrl[self._announceUrl.length - 1] !== '/') self._announceUrl += '/'
|
||||||
|
self._announceUrl += '?' + hat(40)
|
||||||
|
|
||||||
self._peers = {} // peers (offer id -> peer)
|
self._peers = {} // peers (offer id -> peer)
|
||||||
self._socket = null
|
self._socket = null
|
||||||
self._intervalMs = self.client._intervalMs // use client interval initially
|
self._intervalMs = self.client._intervalMs // use client interval initially
|
||||||
@ -98,7 +102,7 @@ WebSocketTracker.prototype._openSocket = function () {
|
|||||||
self._onSocketDataBound = self._onSocketData.bind(self)
|
self._onSocketDataBound = self._onSocketData.bind(self)
|
||||||
self._onSocketCloseBound = self._onSocketClose.bind(self)
|
self._onSocketCloseBound = self._onSocketClose.bind(self)
|
||||||
|
|
||||||
self._socket = new Socket(self._announceUrl + '?' + hat(40))
|
self._socket = new Socket(self._announceUrl)
|
||||||
self._socket.on('data', self._onSocketDataBound)
|
self._socket.on('data', self._onSocketDataBound)
|
||||||
self._socket.on('close', self._onSocketCloseBound)
|
self._socket.on('close', self._onSocketCloseBound)
|
||||||
self._socket.on('error', self._onSocketErrorBound)
|
self._socket.on('error', self._onSocketErrorBound)
|
||||||
|
Loading…
Reference in New Issue
Block a user