fix(server): group dual-session idle penalty by account identity for CGNAT mobile support (#16) - #132
Conversation
| const idleReferenceAt = isDuplicateIpScout | ||
| ? getScoutIdleReferenceAt(client, user) | ||
| : Number(client.lastActivityAt ?? now); | ||
| const idleReferenceAt = Number(client.lastActivityAt ?? now); |
There was a problem hiding this comment.
💡 Quality: Dead constant DUPLICATE_IP_IDLE_TIMEOUT_MS after penalty removal
This commit removes the only consumer of DUPLICATE_IP_IDLE_TIMEOUT_MS (the deleted dual-account scout penalty logic), leaving the constant defined but unused. Remove the declaration at line 32 to avoid dead code. Note also that Number(client.lastActivityAt ?? now) at line 726 is now redundant since lines 721-724 already guarantee lastActivityAt is a number; it can be simplified to client.lastActivityAt.
Delete the now-unused constant and simplify the redundant Number(... ?? now) expression.:
// remove line 32:
// const DUPLICATE_IP_IDLE_TIMEOUT_MS = 60 * 1000;
// line 726 simplify:
const idleReferenceAt = client.lastActivityAt;
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 3 resolved / 4 findingsGroups dual-session idle penalties by account identity to support mobile CGNAT networks and addresses several error handling improvements. Consider removing the now-unused DUPLICATE_IP_IDLE_TIMEOUT_MS constant. 💡 Quality: Dead constant DUPLICATE_IP_IDLE_TIMEOUT_MS after penalty removal📄 server/src/server.ts:32 📄 server/src/server.ts:726 This commit removes the only consumer of Delete the now-unused constant and simplify the redundant Number(... ?? now) expression.✅ 3 resolved✅ Quality: Dead fallback keys account_id and client.accountId never resolve
✅ Quality: ROLLBACK failure can mask the original error
✅ Bug: Account grouping likely neutralizes the anti-scout idle penalty
🤖 Prompt for agentsOptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 7 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
Closes #16
Summary of Changes
Fixes accidental disconnections between different mobile players sharing public carrier IPs under Carrier-Grade NAT (CGNAT) by evaluating dual-session scout penalties against account identity rather than public IP address.
Problem & Root Cause
Under CGNAT mobile networks, multiple distinct players share identical external IPv4 addresses.
getDuplicateIpIdlePenalizedClientIdspreviously grouped clients strictly byclientIp, causing active miners on mobile networks to unintentionally trigger 60-second idle scout kicks on unrelated players connected to the same mobile cell tower.Solution
getDuplicateIpIdlePenalizedClientIdstogetDuplicateAccountIdlePenalizedClientIds.user.idAccount/user.account_id/client.accountId), preserving anti-scout multi-box protections for single accounts while fully supporting concurrent distinct players on mobile CGNAT networks.Summary by Gitar
SIGTERMandSIGINTsignals with a 5-second timeout and/internal/characters/reset-connectedAPI reset.PROTECTED_MAPS) requiring explicitoverrideProtectedflags for superadmins and blocking collaborator access.game_map_permissions) and dynamic map palette overrides (game_map_palette_overrides)./graphics/:grhIndex/metadata,/admin/game-data/maps/:mapNum/palette).This will update automatically on new commits.