From 0a9c254e84152038a001bcef23d2366e36ee26b1 Mon Sep 17 00:00:00 2001 From: Ben Wilson Date: Sun, 6 Aug 2023 19:26:36 -0400 Subject: [PATCH] socket cleanup --- src/models/StratumV1Client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/models/StratumV1Client.ts b/src/models/StratumV1Client.ts index 1bfbcf6..0b92a14 100644 --- a/src/models/StratumV1Client.ts +++ b/src/models/StratumV1Client.ts @@ -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(); }