Retry original username before falling back to an auto-incremented name - #292
Open
kb9gxk wants to merge 1 commit into
Open
Retry original username before falling back to an auto-incremented name#292kb9gxk wants to merge 1 commit into
kb9gxk wants to merge 1 commit into
Conversation
Root cause: the server rejects a login with "access denied" for
any username collision -- whether a genuinely different peer holds
the name, or it's our own stale session from a recent drop/restart
that the server hasn't timed out yet. The client couldn't tell
these apart and always assumed the worst, immediately switching to
an auto-incremented name ("Name 2") on the very first rejection.
Now retries the original name up to 3 times (~2.5s apart) before
falling back to the incremented name, giving a same-device
reconnect a chance to reclaim its name once the stale session
clears server-side. Also decouples the persisted default username
from whatever name the session actually ended up connecting with,
so a fallback name doesn't compound into future sessions -- the
original requested name is always what gets remembered, even if
this particular session is running under a fallback name.
No server-side changes -- the AOO protocol has no in-session
rename message, so reclaiming an already-active fallback session
would require a disruptive disconnect/reconnect; per discussion,
scoped this to the initial-connect retry only, not background
reclaim.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When you reconnect after a dropped connection (network blip, app restart), you often come back into a group renamed to "Name 2" even though your original session is truly gone — not because someone else is using your name, but because the server hasn't timed out your own stale session yet.
The server's login (
get_user()indeps/aoo/lib/src/server.cpp) returns a flat "access denied" for any username collision — it can't distinguish "someone else genuinely has this name" from "this is your own not-yet-expired session from a moment ago." The client currently treats every rejection as the former and immediately switches to an auto-incremented name on the very first failure.This also compounds over time: the auto-incremented name gets saved as your new default username, so future connections start from "Name 2" already, and can creep further ("Name 3", etc.) on subsequent unlucky reconnects.
Changes
Not included
No server-side changes. The AOO protocol has no in-session rename message, so reclaiming an already-active fallback session mid-session would require a disruptive disconnect/reconnect cycle — out of scope here; this only affects the initial-connect path.
Testing
Built clean on both Linux and Windows (MSVC) with no new warnings, against a fresh checkout of
main.