send CopyFail when user close connection

This commit is contained in:
Simon Martín 2018-05-30 12:59:49 +02:00
parent a083eb909c
commit 310f652ae4

View File

@ -61,8 +61,9 @@ module.exports = {
}) })
.on('close', () => { .on('close', () => {
if (!requestEnded) { if (!requestEnded) {
const connection = client.connection;
connection.sendCopyFail();
req.unpipe(pgstream); req.unpipe(pgstream);
pgstream.end();
return cb(new Error('Connection closed by client')); return cb(new Error('Connection closed by client'));
} }
}) })