mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
watchdog
This commit is contained in:
@@ -90,7 +90,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
parsedMessage = JSON.parse(message);
|
parsedMessage = JSON.parse(message);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Invalid JSON");
|
console.log("Invalid JSON");
|
||||||
await this.promiseSocket.end();
|
this.promiseSocket.socket.emit('end', true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +254,6 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
|
|
||||||
|
|
||||||
if (this.clientSubscription != null
|
if (this.clientSubscription != null
|
||||||
// && this.clientConfiguration != null
|
|
||||||
&& this.clientAuthorization != null
|
&& this.clientAuthorization != null
|
||||||
&& this.stratumInitialized == false) {
|
&& this.stratumInitialized == false) {
|
||||||
|
|
||||||
@@ -296,9 +295,9 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const diffSeconds = (now - time.getTime()) / 1000;
|
const diffSeconds = (now - time.getTime()) / 1000;
|
||||||
// five minutes
|
// five minutes
|
||||||
if (diffSeconds > 60 * 5) {
|
if (diffSeconds > 5 * 60) {
|
||||||
console.log('Watchdog ending session');
|
console.log('Watchdog ending session');
|
||||||
await this.promiseSocket.end();
|
this.promiseSocket.socket.emit('end', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,12 +331,8 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
this.stratumV1JobsService.addJob(job);
|
this.stratumV1JobsService.addJob(job);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
await this.promiseSocket.write(job.response(jobTemplate));
|
await this.promiseSocket.write(job.response(jobTemplate));
|
||||||
} catch (e) {
|
|
||||||
await this.promiseSocket.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Sent new job to ${this.clientAuthorization.worker}.${this.extraNonceAndSessionId}. (clearJobs: ${jobTemplate.blockData.clearJobs}, fee?: ${!noFee})`)
|
console.log(`Sent new job to ${this.clientAuthorization.worker}.${this.extraNonceAndSessionId}. (clearJobs: ${jobTemplate.blockData.clearJobs}, fee?: ${!noFee})`)
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
await this.clientService.delete(client.extraNonceAndSessionId);
|
await this.clientService.delete(client.extraNonceAndSessionId);
|
||||||
|
|
||||||
const clientCount = await this.clientService.connectedClientCount();
|
const clientCount = await this.clientService.connectedClientCount();
|
||||||
console.error(`Socket error:`, error);
|
console.log(`Socket error:`, error);
|
||||||
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user