mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
socket error handling
This commit is contained in:
@@ -606,12 +606,17 @@ export class StratumV1Client {
|
|||||||
} else {
|
} else {
|
||||||
console.error(`Error: Cannot write to closed or ended socket. ${this.extraNonceAndSessionId} ${message}`);
|
console.error(`Error: Cannot write to closed or ended socket. ${this.extraNonceAndSessionId} ${message}`);
|
||||||
this.destroy();
|
this.destroy();
|
||||||
|
if (!this.socket.destroyed) {
|
||||||
|
this.socket.destroy();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
if (!this.socket.destroyed && !this.socket.writableEnded) {
|
if (!this.socket.writableEnded) {
|
||||||
await this.socket.end();
|
await this.socket.end();
|
||||||
|
} else if (!this.socket.destroyed) {
|
||||||
|
this.socket.destroy();
|
||||||
}
|
}
|
||||||
console.error(`Error occurred while writing to socket: ${this.extraNonceAndSessionId}`, error);
|
console.error(`Error occurred while writing to socket: ${this.extraNonceAndSessionId}`, error);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user