-
Notifications
You must be signed in to change notification settings - Fork 25
Bloquear la pantalla del celular expulsa al jugador: los pings no cuentan como actividad #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,6 +364,7 @@ async function processFloorItemSweepTick(now: number) { | |
|
|
||
| function trackClientActivity(ws: RuntimeClient, packageID: number) { | ||
| const now = Date.now(); | ||
| ws.lastActivityAt = now; | ||
| const isPingPacket = packageID === pkg.serverPacketID.ping; | ||
|
|
||
| ws.packetCount = Number(ws.packetCount ?? 0) + 1; | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Quality: Remove leftover commented-out lastActivityAt assignmentLine 422 leaves a dead commented-out Drop the leftover commented line.:
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎 |
||
| } | ||
|
|
||
| (async () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👍 / 👎