Skip to content

Commit 72922a6

Browse files
committed
fix regression in 3.0.1
1 parent dd23967 commit 72922a6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

client.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ Tracker.prototype._announce = function (opts) {
219219
var self = this
220220

221221
// defaults, user should provide real values
222-
if (!opts.uploaded) opts.uploaded = 0
223-
if (!opts.downloaded) opts.downloaded = 0
222+
if (opts.uploaded == null) opts.uploaded = 0
223+
if (opts.downloaded == null) opts.downloaded = 0
224224

225225
if (self.client.torrentLength != null && opts.left == null) {
226226
opts.left = self.client.torrentLength - (opts.downloaded || 0)
@@ -261,13 +261,13 @@ Tracker.prototype._requestHttp = function (requestUrl, opts) {
261261
var self = this
262262

263263
if (opts._scrape) {
264-
if (!opts.info_hash) opts.info_hash = self.client._infoHash.toString('binary')
264+
if (opts.info_hash == null) opts.info_hash = self.client._infoHash.toString('binary')
265265
} else {
266-
if (!opts.info_hash) opts.info_hash = self.client._infoHash.toString('binary')
267-
if (!opts.peer_id) opts.peer_id = self.client._peerId.toString('binary')
268-
if (!opts.port) opts.port = self.client._port
269-
if (!opts.compact) opts.compact = 1
270-
if (!opts.numwant) opts.numwant = self.client._numWant
266+
if (opts.info_hash == null) opts.info_hash = self.client._infoHash.toString('binary')
267+
if (opts.peer_id == null) opts.peer_id = self.client._peerId.toString('binary')
268+
if (opts.port == null) opts.port = self.client._port
269+
if (opts.compact == null) opts.compact = 1
270+
if (opts.numwant == null) opts.numwant = self.client._numWant
271271

272272
if (self._trackerId) {
273273
opts.trackerid = self._trackerId

0 commit comments

Comments
 (0)