mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-14 04:39:54 +00:00
[client/ui] Fix stale LoginFailed/NeedsLogin state after profile switch
When the active profile was in LoginFailed, NeedsLogin, or SessionExpired, switching to another profile left the daemon holding stale management/signal errors. The new profile inherited the error state from the previous one. Two fixes: 1. server.go Down(): reset statusRecorder management/signal errors so the next Up() starts with a clean status snapshot instead of the previous profile's error state. 2. tray.go switchProfile(): add NeedsLogin/LoginFailed/SessionExpired to the needsDown set. Down() is called to flush stale daemon state, but Up() is not — the user initiates login on the new profile manually.
This commit is contained in:
@@ -866,6 +866,15 @@ func (s *Server) Down(ctx context.Context, _ *proto.DownRequest) (*proto.DownRes
|
||||
// stuck at Connecting long after the user asked to disconnect.
|
||||
internal.CtxGetState(s.rootCtx).Set(internal.StatusIdle)
|
||||
|
||||
// Clear stale management/signal errors so the next Up() (typically for a
|
||||
// different profile) starts with a clean status snapshot. Without this,
|
||||
// a managementError left over from a LoginFailed cycle persists in the
|
||||
// statusRecorder and appears in the new profile's initial
|
||||
// SubscribeStatus snapshot, making the new profile look like it also
|
||||
// failed to log in.
|
||||
s.statusRecorder.MarkManagementDisconnected(nil)
|
||||
s.statusRecorder.MarkSignalDisconnected(nil)
|
||||
|
||||
return &proto.DownResponse{}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user