end socket on timeout

This commit is contained in:
Ben 2023-10-03 08:02:27 -04:00
parent e9a100433a
commit 5c230d132e

View File

@ -45,8 +45,8 @@ export class StratumV1Service implements OnModuleInit {
private startSocketServer() {
const server = new Server(async (socket: Socket) => {
//5 min
socket.setTimeout(1000 * 60 * 5);
//1 min
socket.setTimeout(1000 * 60);
const client = new StratumV1Client(
socket,
@ -69,6 +69,11 @@ export class StratumV1Service implements OnModuleInit {
}
});
socket.on('timeout', () => {
console.log('socket timeout');
socket.end();
});
socket.on('error', async (error: Error) => { });
// //console.log(`Client disconnected, socket error, ${client.extraNonceAndSessionId}`);