diff --git a/lib/connector/upload.js b/lib/connector/upload.js index 0b0dad8..876d6d0 100755 --- a/lib/connector/upload.js +++ b/lib/connector/upload.js @@ -5,8 +5,6 @@ const _luaCommandBuilder = require('../lua/command-builder'); const _logger = require('logging-facility').getLogger('connector'); const _luaMinifier = require('../lua/minifier'); -// hex write helper already uploaded within current session ? -let _isTransferWriteHelperUploaded = false; let _transferEncoding = null; // utility function to handle the file transfer @@ -85,34 +83,27 @@ async function startTransfer(rawContent, localName, remoteName, progressCb){ // utility function to upload file transfer helper async function requireTransferHelper(){ - // hex write helper already uploaded within current session ? - // otherwise upload helper - if (_isTransferWriteHelperUploaded !== true){ - let response = null; - - try{ - ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.transferWriteHelper)); - - }catch(e){ - _logger.debug(e); - throw new Error('cannot upload transfer helper function'); - } + let response = null; - // get transfer encoding - if (response == 'b'){ - _transferEncoding = 'base64' - }else if (response == 'h'){ - _transferEncoding = 'hex' - }else{ - throw new Error('unknown transfer encoding - ' + response); - } + try{ + ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.transferWriteHelper)); - // show encoding - _logger.log('Transfer-Mode: ' + _transferEncoding); + }catch(e){ + _logger.debug(e); + throw new Error('cannot upload transfer helper function'); + } - // set flag - _isTransferWriteHelperUploaded = true; + // get transfer encoding + if (response == 'b'){ + _transferEncoding = 'base64' + }else if (response == 'h'){ + _transferEncoding = 'hex' + }else{ + throw new Error('unknown transfer encoding - ' + response); } + + // show encoding + _logger.log('Transfer-Mode: ' + _transferEncoding); } async function upload(localName, remoteName, options, progressCb){