Skip to content

Commit f8ea07a

Browse files
committed
Include key param in announce
1 parent eb854e8 commit f8ea07a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

client.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function Client (peerId, port, torrent, opts) {
5454
self._rtcConfig = opts.rtcConfig
5555
self._wrtc = opts.wrtc
5656
self._userAgent = opts.userAgent
57+
self._key = opts.key
5758
self._statsForAnnounce = opts.statsForAnnounce
5859

5960
debug('new client %s', self._infoHashHex)
@@ -266,11 +267,13 @@ Client.prototype._defaultAnnounceOpts = function (opts) {
266267

267268
var providedStats = self._statsForAnnounce ? self._statsForAnnounce() : {}
268269

269-
if (opts.uploaded == null) opts.uploaded = providedStats.uploaded || 0
270-
if (opts.downloaded == null) opts.downloaded = providedStats.downloaded || 0
270+
if (opts.uploaded == null) { opts.uploaded = providedStats.uploaded || 0 }
271+
if (opts.downloaded == null) { opts.downloaded = providedStats.downloaded || 0 }
272+
if (self._key) { opts.key = self._key }
271273

272274
if (opts.left == null && self.torrentLength != null) {
273275
opts.left = self.torrentLength - opts.downloaded
274276
}
277+
275278
return opts
276279
}

0 commit comments

Comments
 (0)