Skip to content

Commit

Permalink
Fix circuit disconnect notification
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMettam committed Nov 18, 2024
1 parent c67732f commit 1df8a4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion lib/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -418,7 +430,6 @@ export class Bot
// No action needed
}).catch(() =>
{
console.error('Timeout waiting for ping from the simulator - possible disconnection')
});


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 1df8a4b

Please sign in to comment.