aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-01-06 16:07:20 -0600
committerGitHub <noreply@github.com>2023-01-06 16:07:20 -0600
commitd5eabb72a5c5a3aed06f0c4b8f66c853468b889b (patch)
treeae4cbb21e0dbb217d8c76e17bdf26462c58d2985 /src
parent9251a1be5f004f022a7e197112d89dd1972571fd (diff)
parent1b5485df80dd0483729fe4ebdb6280e500ab08b3 (diff)
downloadslskd-d5eabb72a5c5a3aed06f0c4b8f66c853468b889b.tar.gz
Merge pull request #824 from slskd/startup
Tweak startup logic
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs34
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);
}
}