From 13e7ff70574c548d66b2c16eba32eb2c43c5ebfc Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 29 Mar 2015 20:41:25 +1300 Subject: [PATCH] set self._opts correctly --- lib/websocket-tracker.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/websocket-tracker.js b/lib/websocket-tracker.js index 07d2b3e..cd97438 100644 --- a/lib/websocket-tracker.js +++ b/lib/websocket-tracker.js @@ -24,6 +24,7 @@ function WebSocketTracker (client, announceUrl, opts) { self.client = client + self._opts = opts self._announceUrl = announceUrl self._peers = {} // peers (offer id -> peer) self._ready = false @@ -124,15 +125,15 @@ WebSocketTracker.prototype._onSocketMessage = function (data) { peer = new Peer({ trickle: false, config: self._opts.rtcConfig }) peer.id = common.binaryToHex(data.peer_id) peer.once('signal', function (answer) { - var opts = { + var params = { info_hash: self.client._infoHash.toString('binary'), peer_id: self.client._peerId.toString('binary'), to_peer_id: data.peer_id, answer: answer, offer_id: data.offer_id } - if (self._trackerId) opts.trackerid = self._trackerId - self._send(opts) + if (self._trackerId) params.trackerid = self._trackerId + self._send(params) }) peer.signal(data.offer) self.client.emit('peer', peer) @@ -150,10 +151,10 @@ WebSocketTracker.prototype._onSocketMessage = function (data) { } } -WebSocketTracker.prototype._send = function (opts) { +WebSocketTracker.prototype._send = function (params) { var self = this - debug('send %s', JSON.stringify(opts)) - self._socket.send(opts) + debug('send %s', JSON.stringify(params)) + self._socket.send(params) } WebSocketTracker.prototype._generateOffers = function (numWant, cb) {