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