switch interval to timeout
This commit is contained in:
parent
49728dc841
commit
1adac4f982
1 changed files with 4 additions and 3 deletions
|
@ -99,8 +99,8 @@ export default class VM {
|
|||
return;
|
||||
}
|
||||
var msg = msgpack.decode(this.#currentChunk!) as protocol.ProtocolMessage;
|
||||
if (this.#nopTimeout) clearInterval(this.#nopTimeout);
|
||||
this.#nopTimeout = setInterval(() => this.#nopTimeoutFunc(), 5000);
|
||||
if (this.#nopTimeout) clearTimeout(this.#nopTimeout);
|
||||
this.#nopTimeout = setTimeout(() => this.#nopTimeoutFunc(), 5000);
|
||||
if (!this.isConnectedToVM) {
|
||||
log("INFO", `Got connection to VM at ${this.#id}`);
|
||||
if (this.#messageQueue.size > 0) this.messageQueueLoop();
|
||||
|
@ -120,9 +120,10 @@ export default class VM {
|
|||
Operation: protocol.ProtocolOperation.NOP
|
||||
});
|
||||
this.#noNop = true;
|
||||
setTimeout(() => this.#nopTimeoutFunc(), 5000);
|
||||
} else {
|
||||
this.isConnectedToVM = false;
|
||||
clearInterval(this.#nopTimeout!);
|
||||
clearTimeout(this.#nopTimeout!);
|
||||
log("INFO", `Connection to VM at ${this.#id} timed out`);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue