Skip to content

fix(serverinfo): clear log at the transition source (amuled side) - #164

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/clear-server-info-on-server-switch
Jun 15, 2026
Merged

fix(serverinfo): clear log at the transition source (amuled side)#164
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/clear-server-info-on-server-switch

Conversation

@got3nks

@got3nks got3nks commented Jun 15, 2026

Copy link
Copy Markdown

Supersedes the first attempt of this PR — the dialog-side EC_OP_CLEAR_SERVERINFO it sent on a server switch raced the new server's welcome message and silently wiped it on amulegui, leaving the Server Info tab empty until B happened to send a second message.

New approach: clear at the source

CamuleApp::ShowConnectionState tracks the connected ed2k server pointer next to the existing old_state flag-bit tracking and clears server_msg on either:

  1. Was connected, now disconnected, OR
  2. Was connected to A, now connected to B (server switch — this transition doesn't flip CONNECTED_ED2K so it wouldn't fire the existing old_state != state branch).

This runs in the amuled process (or in the monolithic build's app), so the clear happens at the transition source — before any of B's messages can land in server_msg. No window for new server messages to be sandwich-cleared after the fact.

CamuleDlg::ShowConnectionState does the same detection but only handles the UI side: ResetLog(ID_SERVERINFO) for the text ctrl. It deliberately does NOT touch the amulegui side's CServerInfoHandlerRem::m_seenSoFar snapshot — clearing it locally before amuled's cleanup landed would let the next poll replay the stale buffer through the "fullLog starts with empty seenSoFar" path. Leaving the snapshot alone lets HandlePacket's existing StartsWith / else-branch logic handle the transition naturally: once amuled's server_msg shortens after its own clear, the prefix mismatches and the else branch resets the local view correctly.

Drops the ClearServerInfo methods added in #163

Both CamuleApp::ClearServerInfo and CamuleRemoteGuiApp::ClearServerInfo are removed — the amuled-side ShowConnectionState path replaces them, and nothing else called them.

Test plan

  • macOS local build (monolithic + amulegui) clean.
  • Manual: connect to A, observe messages → switch to B → Server Info empties and then shows only B's messages once it sends them (no replay of A).
  • Manual: disconnect → text ctrl empties; reconnect → fresh content, no stale tail.
  • Manual: amulegui talking to amuled (both updated) → server switch shows the same behaviour as monolithic.

CamuleApp::ShowConnectionState clears server_msg when the
connected-server pointer changes (was on A -> now on B, or now
disconnected) so amuled wipes its buffer before B's welcome can
arrive. CamuleDlg::ShowConnectionState only handles the UI side
(ResetLog) -- no GUI-side EC clear, which previously raced the new
server's welcome message.

Drops the ClearServerInfo methods added in amule-project#163 -- amuled-side path
replaces them.
@got3nks
got3nks force-pushed the fix/clear-server-info-on-server-switch branch from dec4dca to 924ed1e Compare June 15, 2026 08:59
@got3nks got3nks changed the title fix(serverinfo): also clear log on ed2k server switch fix(serverinfo): clear log at the transition source (amuled side) Jun 15, 2026
@got3nks
got3nks merged commit ba3d915 into amule-org:master Jun 15, 2026
9 checks passed
@got3nks
got3nks deleted the fix/clear-server-info-on-server-switch branch June 15, 2026 09:08
@got3nks got3nks mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant