Comparing version 0.2.10 to 0.2.11
@@ -68,2 +68,3 @@ var fs = require('fs'), | ||
this._debug = undefined; | ||
this._keepalive = undefined; | ||
this.options = { | ||
@@ -77,3 +78,3 @@ host: undefined, | ||
pasvTimeout: undefined, | ||
keepalive: undefined | ||
aliveTimeout: undefined | ||
}; | ||
@@ -96,3 +97,4 @@ this.connected = false; | ||
this.options.pasvTimeout = options.pasvTimeout || 10000; | ||
this.options.keepalive = options.keepalive || 10000; | ||
this.options.aliveTimeout = options.keepalive || 10000; | ||
if (typeof options.debug === 'function') | ||
@@ -116,7 +118,7 @@ this._debug = options.debug; | ||
var keepalive, | ||
noopreq = { | ||
var noopreq = { | ||
cmd: 'NOOP', | ||
cb: function() { | ||
keepalive = setTimeout(donoop, self.options.keepalive); | ||
clearTimeout(self._keepalive); | ||
self._keepalive = setTimeout(donoop, self.options.aliveTimeout); | ||
} | ||
@@ -127,8 +129,9 @@ }; | ||
if (!self._socket || !self._socket.writable) | ||
clearTimeout(keepalive); | ||
clearTimeout(self._keepalive); | ||
else if (!self._curReq && self._queue.length === 0) { | ||
self._curReq = noopreq; | ||
debug&&debug('> NOOP'); | ||
self._socket.write(bytesNOOP); | ||
} else | ||
keepalive = setTimeout(donoop, self.options.keepalive); | ||
noopreq.cb(); | ||
} | ||
@@ -138,3 +141,3 @@ | ||
clearTimeout(timer); | ||
clearTimeout(keepalive); | ||
clearTimeout(self._keepalive); | ||
self.connected = true; | ||
@@ -207,6 +210,5 @@ self._socket = socket; // re-assign for implicit secure connections | ||
self._send('TYPE I', reentry, true); | ||
} else if (cmd === 'TYPE') { | ||
donoop(); | ||
} else if (cmd === 'TYPE') | ||
self.emit('ready'); | ||
} else if (cmd === 'PBSZ') { | ||
else if (cmd === 'PBSZ') { | ||
cmd = 'PROT'; | ||
@@ -286,2 +288,4 @@ self._send('PROT P', reentry, true); | ||
} | ||
noopreq.cb(); | ||
} | ||
@@ -292,3 +296,3 @@ }; | ||
clearTimeout(timer); | ||
clearTimeout(keepalive); | ||
clearTimeout(self._keepalive); | ||
self.emit('error', err); | ||
@@ -313,4 +317,2 @@ }); | ||
clearTimeout(timer); | ||
clearTimeout(keepalive); | ||
self.connected = false; | ||
self._reset(); | ||
@@ -955,2 +957,3 @@ } | ||
FTP.prototype._send = function(cmd, cb, promote) { | ||
clearTimeout(this._keepalive); | ||
if (cmd !== undefined) { | ||
@@ -975,6 +978,2 @@ if (promote) | ||
this._socket.end(); | ||
if (this._socket && this._socket.connTimer) | ||
clearTimeout(this._socket.connTimer); | ||
if (this._socket && this._socket.keepalive) | ||
clearInterval(this._socket.keepalive); | ||
this._socket = undefined; | ||
@@ -985,2 +984,4 @@ this._pasvSock = undefined; | ||
this._secstate = undefined; | ||
clearTimeout(this._keepalive); | ||
this._keepalive = undefined; | ||
this._queue = []; | ||
@@ -987,0 +988,0 @@ this._buffer = ''; |
{ "name": "ftp", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"author": "Brian White <mscdex@mscdex.net>", | ||
@@ -4,0 +4,0 @@ "description": "An FTP client module for node.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40706
973