Skip to content

Commit

Permalink
Add error check on socket close handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cvasseng committed Nov 13, 2024
1 parent e44a649 commit 85df9c1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/server/routes/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ const exportHandler = async (request, response, next) => {
let connectionAborted = false;

// In case the connection is closed, force to abort further actions
request.socket.on('close', () => {
connectionAborted = true;
});

request.socket.on('clientError', () => {
connectionAborted = true;
request.socket.on('close', (hadErrors) => {
if (hadErrors) {
connectionAborted = true;
}
});

log(4, `[export] Got an incoming HTTP request with ID ${uniqueId}.`);
Expand Down

0 comments on commit 85df9c1

Please sign in to comment.