mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 02:21:36 +00:00
Fix bug where left = 0 would be converted to Infinity
Possibly fixes: https://github.com/feross/bittorrent-tracker/issues/196
This commit is contained in:
parent
27ae148167
commit
c2c8e36af7
@ -28,7 +28,9 @@ function parseWebSocketRequest (socket, opts, params) {
|
|||||||
params.to_peer_id = common.binaryToHex(params.to_peer_id)
|
params.to_peer_id = common.binaryToHex(params.to_peer_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
params.left = Number(params.left) || Infinity
|
params.left = Number(params.left)
|
||||||
|
if (Number.isNaN(params.left)) params.left = Infinity
|
||||||
|
|
||||||
params.numwant = Math.min(
|
params.numwant = Math.min(
|
||||||
Number(params.offers && params.offers.length) || 0, // no default - explicit only
|
Number(params.offers && params.offers.length) || 0, // no default - explicit only
|
||||||
common.MAX_ANNOUNCE_PEERS
|
common.MAX_ANNOUNCE_PEERS
|
||||||
|
Loading…
Reference in New Issue
Block a user