Skip to content

[Netcode] Reconnecting after a connection drop almost never works (session already expired) #117

Done

Description

@Greevee

Source: anonymous network statistics from players who opted in (first data since 0.6.0, Nov 25–26 – small sample).

What the numbers say

  • Attempts to resume a session after a connection drop failed 29 times because the session had already expired.
  • Client reports show 0 successful reconnects.
  • Most connections don't end cleanly: only 4 clean closes vs. 36 "replaced by a new connection" and 26 connection resets.

So when a connection drops, getting back into the running session practically never works – the player comes back too late, or the window to come back is too short.

Goal
After a short drop, players (including the host) get back into their lobby or match automatically.

To do

  • Check the timing: how long does the client take to reconnect vs. how long the server keeps the session.
  • Make the resume window fit real-world drops (Wi-Fi hiccups, router reconnects).
  • Show the player that a reconnect is in progress instead of just dropping them.

Closely related to #116.

Activity

  1. added
    bug
    game: LoC
    fixed-0.6.3
    on Nov 26, 2026
  2. Greevee commented on Nov 26, 2026

    @Greevee
    ContributorAuthor

    Thanks for the report and for sharing the network statistics – they made the cause visible.

    What was going on

    • The "session expired" count was misleading. The server wrote that line for every held session that nobody came back to – including every normal game exit, because the game never signed out when you closed it. In the period I looked at, not a single real reconnect attempt reached the server, so none could fail or succeed.
    • For real drops the time window was too short. The server held a session for 90 seconds counted from your last message. A silent drop (Wi-Fi hiccup, router reconnect) is only noticed after 45 seconds, so only about 45 seconds were left – and the game itself often noticed the dead connection even later.

    What changes in 0.6.3

    • The server holds your session for two minutes from the moment it notices the drop.
    • The game notices a dead connection by itself after 40 seconds of silence and keeps trying for almost two minutes. While it does, it shows "Reconnecting to steelnet ...", then "Reconnected". The other players stay connected all the time.
    • Closing the game now signs you out properly, so the lobby updates at once and exits no longer show up as failed reconnects.
    • All the security rules of the reconnect stay as they were: the token works once, only for your account and this session, and only after a fresh sign-in proof.

    In my lab test the host lost the server connection for 90 seconds in the middle of a match (the router-reconnect case): before the fix the match fell apart for all three players, now the host reconnected after about a minute and the match went on with no desync.

    If it still happens to you after updating, the netstats report will now say exactly which case it was – I'd be glad if you keep sharing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixed-0.6.3game: LoC

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions