implement TCP server, reimplement maxConnections except it now kicks the oldest connection

This commit is contained in:
Elijah R
2024-05-27 00:06:05 -04:00
parent 7053973205
commit 8add016b60
7 changed files with 115 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ import * as Shared from '@cvmts/shared';
import AuthManager from './AuthManager.js';
import WSServer from './WebSocket/WSServer.js';
import { User } from './User.js';
import TCPServer from './TCP/TCPServer.js';
let logger = new Shared.Logger('CVMTS.Init');
@@ -58,5 +59,11 @@ async function start() {
var WS = new WSServer(Config);
WS.on('connect', (client: User) => CVM.addUser(client));
WS.start();
if (Config.tcp.enabled) {
var TCP = new TCPServer(Config);
TCP.on('connect', (client: User) => CVM.addUser(client));
TCP.start();
}
}
start();