Fix circuit disconnect notification

This commit is contained in:
Casper Warden
2024-11-18 17:50:30 +00:00
parent 540ca96697
commit 4347fbe4b5
2 changed files with 13 additions and 2 deletions

View File

@@ -364,6 +364,18 @@ export class Bot
this.ping = setInterval(async() =>
{
const now = new Date().getTime();
if (now - this.lastSuccessfulPing > 120 * 1000)
{
if (this.ping !== null)
{
clearInterval(this.ping);
this.ping = null;
this.disconnected(false, 'Disconnected from the simulator');
}
return;
}
this.pingNumber++;
if (this.pingNumber % 12 === 0 && this.stay)
{
@@ -418,7 +430,6 @@ export class Bot
// No action needed
}).catch(() =>
{
console.error('Timeout waiting for ping from the simulator - possible disconnection')
});

View File

@@ -1,6 +1,6 @@
{
"name": "@caspertech/node-metaverse",
"version": "0.7.29",
"version": "0.7.40",
"description": "A node.js interface for Second Life.",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",