From 36377d5a7fb4f9550a0610816d3688ac4973c1a9 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 2 Mar 2017 12:04:09 -0800 Subject: [PATCH] upnp: better params for addPortMapping. --- lib/net/upnp.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/net/upnp.js b/lib/net/upnp.js index 2c8a2897..c1357b04 100644 --- a/lib/net/upnp.js +++ b/lib/net/upnp.js @@ -505,11 +505,12 @@ UPNPService.prototype.getExternalIP = co(function* () { /** * Attempt to add port mapping to local IP. * @param {String} remote - Remote IP. - * @param {Number} port - Local and remote port. + * @param {Number} src - Remote port. + * @param {Number} dest - Local port. * @returns {Promise} */ -UPNPService.prototype.addPortMapping = co(function* (remote, port) { +UPNPService.prototype.addPortMapping = co(function* (remote, src, dest) { var action = 'AddPortMapping'; var local = UPNP.getLocalIP(); var xml, child; @@ -519,10 +520,10 @@ UPNPService.prototype.addPortMapping = co(function* (remote, port) { xml = yield this.soapRequest(action, [ ['NewRemoteHost', remote], - ['NewExternalPort', port], + ['NewExternalPort', src], ['NewProtocol', 'TCP'], ['NewInternalClient', local], - ['NewInternalPort', port], + ['NewInternalPort', dest], ['NewEnabled', 'True'], ['NewPortMappingDescription', 'upnp:bcoin'], ['NewLeaseDuration', 0] @@ -539,7 +540,7 @@ UPNPService.prototype.addPortMapping = co(function* (remote, port) { /** * Attempt to remove port mapping from local IP. * @param {String} remote - Remote IP. - * @param {Number} port - Local and remote port. + * @param {Number} port - Remote port. * @returns {Promise} */