mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
multi port
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ BITCOIN_RPC_TIMEOUT=10000
|
|||||||
# BITCOIN_ZMQ_HOST="tcp://192.168.1.100:3000"
|
# BITCOIN_ZMQ_HOST="tcp://192.168.1.100:3000"
|
||||||
|
|
||||||
API_PORT=3334
|
API_PORT=3334
|
||||||
STRATUM_PORT=3333
|
STRATUM_PORTS=3333,3332,3331,3330
|
||||||
|
|
||||||
#optional telegram bot
|
#optional telegram bot
|
||||||
#TELEGRAM_BOT_TOKEN=
|
#TELEGRAM_BOT_TOKEN=
|
||||||
|
|||||||
@@ -33,12 +33,15 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
if (process.env.NODE_APP_INSTANCE == '0') {
|
if (process.env.NODE_APP_INSTANCE == '0') {
|
||||||
await this.clientService.deleteAll();
|
await this.clientService.deleteAll();
|
||||||
}
|
}
|
||||||
this.startSocketServer();
|
setTimeout(() => {
|
||||||
|
process.env.STRATUM_PORTS.split(',').forEach(port =>{
|
||||||
|
this.startSocketServer(parseInt(port));
|
||||||
|
});
|
||||||
|
}, 1000 * 10)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private startSocketServer() {
|
private startSocketServer(port: number) {
|
||||||
const server = new Server(async (socket: Socket) => {
|
const server = new Server(async (socket: Socket) => {
|
||||||
|
|
||||||
//10 min
|
//10 min
|
||||||
@@ -78,8 +81,8 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(process.env.STRATUM_PORT, () => {
|
server.listen(port, () => {
|
||||||
console.log(`Stratum server is listening on port ${process.env.STRATUM_PORT}`);
|
console.log(`Stratum server is listening on port ${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user