parse params.left = 0 properly

This commit is contained in:
Sidd Sridharan 2016-12-03 21:07:26 -08:00
parent 3a0fec0701
commit 9d9893a0f2

View File

@ -24,7 +24,9 @@ function parseHttpRequest (req, opts) {
params.port = Number(params.port)
if (!params.port) throw new Error('invalid port')
params.left = Number(params.left) || Infinity
params.left = Number(params.left)
if (isNaN(params.left)) params.left = Infinity
params.compact = Number(params.compact) || 0
params.numwant = Math.min(
Number(params.numwant) || common.DEFAULT_ANNOUNCE_PEERS,