mirror of
https://github.com/opentibiabr/canary
synced 2026-08-16 06:26:09 -04:00
fix(network): make protocol cleanup reliable under dispatcher saturation Resolves #3585. Make Connection::close cleanup reliable when dispatcher immediate queues are saturated. Before this change, Connection::close ignored the boolean returned by Dispatcher::addEvent and submitted Protocol::release with a 30-second expiration. Under sustained dispatcher backlog, the cleanup callback could be rejected at admission or expire before execution. That could leave ProtocolGame attached to its player longer than intended, pushing the eventual cleanup into the regular ping-timeout path and making the delay appear in Game::checkCreatures telemetry. Main changes: - Remove the expiration from Protocol::release dispatch. - Try ProtocolInput first for protocol cleanup. - Fall back to WorldCommit when ProtocolInput rejects admission. - Retain the closing connection and retry after 50 ms when both dispatcher lanes reject admission. - Keep at most one retry timer per closing connection. - Treat dispatcher shutdown as terminal and avoid rearming the I/O retry in that case. - Rate-limit the dispatcher saturation warning globally to once every 5 seconds. - Keep all protocol and player ownership mutation on the dispatcher thread. Behavior: - Closing connections now retain ownership until a non-expiring protocol-release callback is accepted by a dispatcher lane. - Saturation is reported without flooding logs. - Normal disconnected-player reconnect window remains unchanged. - Existing 60-second forced logout behavior remains unchanged. Tests: - Add unit coverage for boolean fallback-lane admission. - Add unit coverage for terminal dispatcher shutdown classification. - Run git diff --check. - Verify the changed C++ ranges against the repository clang-format configuration. - Local build and executable unit tests were not run; GitHub Actions provides executable validation for this PR. Documentation: - Update performance and lifetime documentation with reliable network-close cleanup requirements. This prevents protocol cleanup from being silently dropped or expired during dispatcher backlog while preserving dispatcher ownership and existing disconnect behavior. |
||
|---|---|---|
| .. | ||
| livestream | ||
| performance-lifetime | ||
| client-15-25-compatibility-update.md | ||
| content-reference-auditor.md | ||
| expert-pvp-implementation-roadmap.md | ||
| expert-pvp-porting-plan.md | ||
| lua-api-docgen.md | ||
| lua-shared-userdata.md | ||
| multiprotocol.md | ||
| README.md | ||
| weapon-proficiency.md | ||
Systems
System documentation covers cross-cutting server features that span multiple modules, message handlers, scripts, database state, or external integration points.