From fca218dc60eb1640ae51b59ea7d0bb5d3d50c6e9 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Tue, 25 Mar 2025 10:40:45 +0100 Subject: [PATCH] Allow trayicon without server This adds support for starting the trayicon even if there is no server. The trayicon will start up in a disconnected state and stay like that until it manages to connect. This fixes Support TrayIcon running with no connection #5993 --- .../GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs | 2 +- Duplicati/GUI/Duplicati.GUI.TrayIcon/Program.cs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs index 481744afc..4f4e47a2c 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/HttpServerConnection.cs @@ -102,7 +102,7 @@ namespace Duplicati.GUI.TrayIcon private long m_lastDataUpdateId = -1; private bool m_disableTrayIconLogin; - private volatile IServerStatus m_status; + private volatile IServerStatus m_status = new ServerStatusImpl(LiveControlState.Paused, SuggestedStatusIcon.Disconnected, 0, 0, 0); private volatile bool m_shutdown = false; private volatile Thread m_requestThread; diff --git a/Duplicati/GUI/Duplicati.GUI.TrayIcon/Program.cs b/Duplicati/GUI/Duplicati.GUI.TrayIcon/Program.cs index c1cc97bdd..e50ca6d51 100644 --- a/Duplicati/GUI/Duplicati.GUI.TrayIcon/Program.cs +++ b/Duplicati/GUI/Duplicati.GUI.TrayIcon/Program.cs @@ -214,10 +214,8 @@ No password provided, unable to connect to server, exiting"); ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault; using (Connection = new HttpServerConnection(serverURL, password, passwordSource, disableTrayIconLogin, acceptedHostCertificate, options)) { - // Make sure we have the latest status - // This will throw an exception if the server is not running, - // or the password is incorrect - Connection.UpdateStatus().Await(); + // Make sure we have the latest status, but don't care if it fails + Connection.UpdateStatus().FireAndForget(); using (var tk = RunTrayIcon()) {