Skip to content

Commit

Permalink
Merge pull request #3 from Tchoupinax/main
Browse files Browse the repository at this point in the history
fix: correctly destroy socket when destroy function is called on
  • Loading branch information
spetz authored Nov 23, 2024
2 parents c477f65 + 0f8c993 commit 845f472
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/client/client.socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const wrapSocket = (socket: Socket) =>
debug('responseStream.connect event');
resolve(responseStream);
});
socket.on('close', () => { console.error('socket#close'); reject(); });
socket.on('close', () => { debug('socket#close'); reject(); });
socket.on('end', () => { console.error('socket#end'); reject(); });
});

Expand Down Expand Up @@ -54,6 +54,11 @@ export class CommandResponseStream extends Duplex {
this.isAuthenticated = false;
};

// Probably triggered by Duplex class
_destroy() {
this._socket.destroy();
}

_read(size: number): void {
this._readPaused = false;
debug('stream#_read', size);
Expand Down

0 comments on commit 845f472

Please sign in to comment.