aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-01-06 15:53:30 -0600
committerJP Dillingham <jp@dillingham.me>2023-01-06 15:53:30 -0600
commit01f33f56c103d6ba229856abffbf66292bed03ff (patch)
tree61978424fba5c0426982d7d8de1ba71cc6c06e41
parent9251a1be5f004f022a7e197112d89dd1972571fd (diff)
downloadslskd-01f33f56c103d6ba229856abffbf66292bed03ff.tar.gz
tweak startup logic
-rw-r--r--src/slskd/Application.cs36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 30fee1be..0da48ae5 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -400,32 +400,38 @@ 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)
+ {
+ if (OptionsAtStartup.Relay.Mode.ToEnum<RelayMode>() == RelayMode.Debug)
+ {
+ Log.Warning("Running in Debug relay mode; connecting to controller");
+ _ = Relay.Client.StartAsync(cancellationToken);
+ }
+ else
+ {
+ Log.Information("Running in Controller relay mode. Listening for incoming Agent connections.");
+ }
+ }
+
+ if (OptionsAtStartup.Flags.NoConnect)
{
- Log.Warning("Running in Debug relay mode; connecting to controller");
- _ = Relay.Client.StartAsync(cancellationToken);
+ 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);
}
}