log vm connection
This commit is contained in:
parent
028f0f1f66
commit
49728dc841
2 changed files with 6 additions and 2 deletions
|
@ -17,12 +17,14 @@ export default class VM {
|
|||
#noNop : boolean = false;
|
||||
connected : boolean = false;
|
||||
#events : EventEmitter;
|
||||
#id : string;
|
||||
|
||||
#currentChunkSize : number | null = null;
|
||||
#currentChunk : Buffer | null = null;
|
||||
#currentChunkOffset : number = 0;
|
||||
constructor(socketpath : string) {
|
||||
constructor(socketpath : string, id : string) {
|
||||
this.#socketpath = socketpath;
|
||||
this.#id = id;
|
||||
this.#socket = new Socket();
|
||||
this.#socket.connect(socketpath);
|
||||
this.#socket.on('connect', () => {
|
||||
|
@ -100,6 +102,7 @@ export default class VM {
|
|||
if (this.#nopTimeout) clearInterval(this.#nopTimeout);
|
||||
this.#nopTimeout = setInterval(() => this.#nopTimeoutFunc(), 5000);
|
||||
if (!this.isConnectedToVM) {
|
||||
log("INFO", `Got connection to VM at ${this.#id}`);
|
||||
if (this.#messageQueue.size > 0) this.messageQueueLoop();
|
||||
this.isConnectedToVM = true;
|
||||
this.#noNop = false;
|
||||
|
@ -120,6 +123,7 @@ export default class VM {
|
|||
} else {
|
||||
this.isConnectedToVM = false;
|
||||
clearInterval(this.#nopTimeout!);
|
||||
log("INFO", `Connection to VM at ${this.#id} timed out`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ if (config.DiscordWebhook) {
|
|||
|
||||
var VMs = new Map<string, VM>();
|
||||
config.VMs.forEach((v) => {
|
||||
VMs.set(v.ID, new VM(v.SocketPath));
|
||||
VMs.set(v.ID, new VM(v.SocketPath, v.ID));
|
||||
});
|
||||
|
||||
var IPs = new Map<string, RateLimit>();
|
||||
|
|
Loading…
Reference in a new issue