Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ async function processFloorItemSweepTick(now: number) {

function trackClientActivity(ws: RuntimeClient, packageID: number) {
const now = Date.now();
ws.lastActivityAt = now;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Edge Case: Ping keepalive now defeats AFK idle-disconnect entirely

The frontend sends a ping every 10s via setInterval(sendPing, 10000) as an automatic keepalive, independent of any user action. By moving ws.lastActivityAt = now before the ping early-return, every connected client with a live socket refreshes lastActivityAt every 10s, so processIdleCharactersTick's idleCharacterTimeoutMs check (server/src/server.ts:735) can never fire for a normally connected client. This fixes the locked-screen case but also disables the general AFK slot-reclamation the idle timeout was built for: only clients that fully stop sending packets get cleaned. If freeing slots from truly-idle-but-connected players is still desired, gate idle detection on gameplay activity (e.g. movement/combat timestamps as getScoutIdleReferenceAt already does) rather than raw connection liveness.

Was this helpful? React with 👍 / 👎

const isPingPacket = packageID === pkg.serverPacketID.ping;

ws.packetCount = Number(ws.packetCount ?? 0) + 1;
Expand Down Expand Up @@ -418,7 +419,7 @@ function trackClientActivity(ws: RuntimeClient, packageID: number) {
}

ws.lastPacketAt = now;
ws.lastActivityAt = now;
// ws.lastActivityAt = now; // moved up - now updated for ping packets too
Comment on lines 421 to +422

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: Remove leftover commented-out lastActivityAt assignment

Line 422 leaves a dead commented-out // ws.lastActivityAt = now; // moved up ... in place of the removed assignment. This is clutter that describes the diff rather than the code; delete the comment since the reasoning belongs in the commit message, not the source.

Drop the leftover commented line.:

    ws.lastPacketAt = now;
}
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

}

(async () => {
Expand Down
Loading