socket cleanup

This commit is contained in:
Ben Wilson
2023-08-06 19:26:36 -04:00
parent 0fcb2ec070
commit 0a9c254e84
+2
View File
@@ -561,9 +561,11 @@ export class StratumV1Client {
return true;
} else {
console.error('Error: Cannot write to closed or ended socket.');
this.destroy();
return false;
}
} catch (error) {
this.destroy();
if (!this.socket.destroyed && !this.socket.writableEnded) {
await this.socket.end();
}