Test a solution

This commit is contained in:
cgonzalez 2021-03-24 10:15:27 +00:00
parent 2c1700b3bd
commit acff0c0413

View File

@ -327,12 +327,11 @@ function ExportRequest (ostream, callback, beforeSink) {
this.canceled = false;
var that = this;
logger.info({ custom: true }, 'New export request');
this.ostream.on('close', function () {
logger.info({ custom: true }, 'Stream closed');
that.canceled = true;
if (that.istream) {
logger.info({ custom: true }, 'Destroying stream');
that.istream.destroy();
}
}).on('pipe', function(src) {
@ -345,9 +344,9 @@ ExportRequest.prototype.sendFile = function (err, filename, callback) {
logger.info({ custom: true }, 'There is an error sending file');
return callback(err);
}
logger.info({ custom: true }, 'sendFile');
logger.info({ custom: true, destroyed: this.ostream.connection.destroyed }, 'sendFile');
var that = this;
if (!this.canceled) {
if (!this.canceled && !this.ostream.connection.destroyed) {
logger.info({ custom: true }, 'Not cancelled (sending file)');
this.istream = fs.createReadStream(filename)
.on('open', function (/* fd */) {