From 1a4b2d32f21c478d134a19949c158df54375f206 Mon Sep 17 00:00:00 2001 From: raphael Date: Mon, 23 Nov 2015 15:37:52 +0100 Subject: [PATCH] adding localAddress --- lib/jsftp.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jsftp.js b/lib/jsftp.js index 6e8e5d3..bb31174 100644 --- a/lib/jsftp.js +++ b/lib/jsftp.js @@ -99,7 +99,7 @@ var Ftp = module.exports = function(cfg) { self.emit('jsftp_debug', 'response', data || {}); }); - this._createSocket(this.port, this.host); + this._createSocket({port:this.port, host:this.host, localAddress:this.localAddress}); }; util.inherits(Ftp, EventEmitter); @@ -121,7 +121,7 @@ Ftp.prototype.reemit = function(event) { }; }; -Ftp.prototype._createSocket = function(port, host, firstAction) { +Ftp.prototype._createSocket = function(options, firstAction) { if (this.socket && this.socket.destroy) { this.socket.destroy(); } @@ -132,7 +132,7 @@ Ftp.prototype._createSocket = function(port, host, firstAction) { this.resParser = new ResponseParser(); this.authenticated = false; - this.socket = Net.createConnection(port, host, firstAction || NOOP); + this.socket = Net.createConnection(options, firstAction || NOOP); this.socket.on('connect', this.reemit('connect')); this.socket.on('timeout', this.reemit('timeout')); @@ -217,7 +217,7 @@ Ftp.prototype.execute = function(action, callback) { var self = this; this.authenticated = false; - this._createSocket(this.port, this.host, function() { + this._createSocket({port:this.port, host:this.host, localAddress:this.localAddress}, function() { self.runCommand(action, callback || NOOP); }); };