From 4cd88b129cce47f8f84b75994f9fb326cf5b7703 Mon Sep 17 00:00:00 2001 From: techmunk Date: Wed, 9 Dec 2020 04:05:50 +1000 Subject: [PATCH] fix: ensure commandSocket is set before retrieving ip address of connection (#222) --- src/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connection.js b/src/connection.js index 578f0538..fc965038 100644 --- a/src/connection.js +++ b/src/connection.js @@ -14,6 +14,7 @@ class FtpConnection extends EventEmitter { super(); this.server = server; this.id = uuid.v4(); + this.commandSocket = options.socket; this.log = options.log.child({id: this.id, ip: this.ip}); this.commands = new Commands(this); this.transferType = 'binary'; @@ -24,7 +25,6 @@ class FtpConnection extends EventEmitter { this.connector = new BaseConnector(this); - this.commandSocket = options.socket; this.commandSocket.on('error', (err) => { this.log.error(err, 'Client error'); this.server.emit('client-error', {connection: this, context: 'commandSocket', error: err});