parseUdpRequest(): fix params.ip

This commit is contained in:
Astro 2014-12-11 16:11:12 +01:00
parent e234f14d56
commit 7a417a591d
2 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,5 @@
var bufferEqual = require('buffer-equal') var bufferEqual = require('buffer-equal')
var ipLib = require('ip')
var common = require('./common') var common = require('./common')
@ -38,7 +39,7 @@ function parseUdpRequest (msg, rinfo) {
params.ip = msg.readUInt32BE(84) // optional params.ip = msg.readUInt32BE(84) // optional
params.ip = params.ip ? params.ip = params.ip ?
ipLib.toString(params.ip) : ipLib.toString(params.ip) :
params.ip = rinfo.address rinfo.address
params.key = msg.readUInt32BE(88) // TODO: what is this for? params.key = msg.readUInt32BE(88) // TODO: what is this for?
params.numwant = msg.readUInt32BE(92) // optional params.numwant = msg.readUInt32BE(92) // optional
// never send more than MAX_ANNOUNCE_PEERS or else the UDP packet will get bigger than // never send more than MAX_ANNOUNCE_PEERS or else the UDP packet will get bigger than

View File

@ -6,7 +6,6 @@ var dgram = require('dgram')
var EventEmitter = require('events').EventEmitter var EventEmitter = require('events').EventEmitter
var http = require('http') var http = require('http')
var inherits = require('inherits') var inherits = require('inherits')
var ipLib = require('ip')
var portfinder = require('portfinder') var portfinder = require('portfinder')
var series = require('run-series') var series = require('run-series')
var string2compact = require('string2compact') var string2compact = require('string2compact')