Skip to content

Commit

Permalink
fix: unhandled 'error' event
Browse files Browse the repository at this point in the history
  • Loading branch information
L2jLiga authored and mantoni committed Oct 4, 2024
1 parent d103ed1 commit 93064d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/forwarder.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ function connectToDaemon(config) {
return new Promise((resolve, reject) => {
const socket = net.connect(config.port, '127.0.0.1');
socket
.on('connect', () => resolve(socket))
.on('connectionAttemptFailed', (err) => {
reject(err);
socket.end();
});
.on('connect', () => {
socket.off('error', reject);
resolve(socket);
})
.once('error', reject);
});
}

Expand Down

0 comments on commit 93064d0

Please sign in to comment.