diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-01-06 16:07:20 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-06 16:07:20 -0600 |
| commit | d5eabb72a5c5a3aed06f0c4b8f66c853468b889b (patch) | |
| tree | ae4cbb21e0dbb217d8c76e17bdf26462c58d2985 /src | |
| parent | 9251a1be5f004f022a7e197112d89dd1972571fd (diff) | |
| parent | 1b5485df80dd0483729fe4ebdb6280e500ab08b3 (diff) | |
| download | slskd-d5eabb72a5c5a3aed06f0c4b8f66c853468b889b.tar.gz | |
Merge pull request #824 from slskd/startup
Tweak startup logic
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 30fee1be..01df00a1 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -400,32 +400,36 @@ namespace slskd } } - if (OptionsAtStartup.Flags.NoConnect) - { - Log.Warning("Not connecting to the Soulseek server; 'no-connect' option is enabled"); - } - else if (string.IsNullOrEmpty(OptionsAtStartup.Soulseek.Username) || string.IsNullOrEmpty(OptionsAtStartup.Soulseek.Password)) - { - Log.Warning($"Not connecting to the Soulseek server; username and/or password invalid. Specify valid credentials and manually connect, or update config and restart."); - } - else if (OptionsAtStartup.Relay.Enabled && OptionsAtStartup.Relay.Mode.ToEnum<RelayMode>() == RelayMode.Agent) + if (OptionsAtStartup.Relay.Enabled && OptionsAtStartup.Relay.Mode.ToEnum<RelayMode>() == RelayMode.Agent) { Log.Information("Running in Agent relay mode; not connecting to the Soulseek server."); await Relay.Client.StartAsync(cancellationToken); } else { - if (OptionsAtStartup.Relay.Enabled && OptionsAtStartup.Relay.Mode.ToEnum<RelayMode>() == RelayMode.Debug) + if (OptionsAtStartup.Relay.Enabled) { - Log.Warning("Running in Debug relay mode; connecting to controller"); - _ = Relay.Client.StartAsync(cancellationToken); + Log.Information("Running in Controller relay mode. Listening for incoming Agent connections."); + + if (OptionsAtStartup.Relay.Mode.ToEnum<RelayMode>() == RelayMode.Debug) + { + Log.Warning("Running in Debug relay mode; connecting to controller"); + _ = Relay.Client.StartAsync(cancellationToken); + } + } + + if (OptionsAtStartup.Flags.NoConnect) + { + Log.Warning("Not connecting to the Soulseek server; 'no-connect' option is enabled"); + } + else if (string.IsNullOrEmpty(OptionsAtStartup.Soulseek.Username) || string.IsNullOrEmpty(OptionsAtStartup.Soulseek.Password)) + { + Log.Warning($"Not connecting to the Soulseek server; username and/or password invalid. Specify valid credentials and manually connect, or update config and restart."); } else { - Log.Information("Running in Controller relay mode. Listening for incoming Agent connections."); + await Client.ConnectAsync(OptionsAtStartup.Soulseek.Username, OptionsAtStartup.Soulseek.Password).ConfigureAwait(false); } - - await Client.ConnectAsync(OptionsAtStartup.Soulseek.Username, OptionsAtStartup.Soulseek.Password).ConfigureAwait(false); } } |
