Fix circuit disconnect notification
This commit is contained in:
13
lib/Bot.ts
13
lib/Bot.ts
@@ -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')
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user