aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-05-16 23:28:11 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-05-16 23:28:11 -0500
commit00cd66c8e74488244220f1c5e6cbb59253c022b1 (patch)
tree3702ee14b831ea19a675589379a91fc04ec1f756 /src
parentfe6cb87f7a24cd09149c1bf5a90954c52dace426 (diff)
downloadslskd-00cd66c8e74488244220f1c5e6cbb59253c022b1.tar.gz
don't set proxy options if none are supplied. log info when using proxy
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Service.cs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/slskd/Service.cs b/src/slskd/Service.cs
index d7ea664e..8daab772 100644
--- a/src/slskd/Service.cs
+++ b/src/slskd/Service.cs
@@ -54,11 +54,16 @@ namespace slskd
RoomTracker = roomTracker;
SharedFileCache = sharedFileCache;
- var proxyOptions = new ProxyOptions(
- address: Options.Soulseek.Connection.Proxy.Address,
- port: Options.Soulseek.Connection.Proxy.Port,
- username: Options.Soulseek.Connection.Proxy.Username,
- password: Options.Soulseek.Connection.Proxy.Password);
+ ProxyOptions proxyOptions = default;
+
+ if (UsingProxy)
+ {
+ proxyOptions = new ProxyOptions(
+ address: Options.Soulseek.Connection.Proxy.Address,
+ port: Options.Soulseek.Connection.Proxy.Port.Value,
+ username: Options.Soulseek.Connection.Proxy.Username,
+ password: Options.Soulseek.Connection.Proxy.Password);
+ }
var connectionOptions = new ConnectionOptions(
readBufferSize: Options.Soulseek.Connection.Buffer.Read,
@@ -129,11 +134,17 @@ namespace slskd
private IRoomTracker RoomTracker { get; set; }
private ISharedFileCache SharedFileCache { get; set; }
private ITransferTracker TransferTracker { get; set; }
+ private bool UsingProxy => !string.IsNullOrWhiteSpace(Options.Soulseek.Connection.Proxy.Address) && Options.Soulseek.Connection.Proxy.Port.HasValue;
public async Task StartAsync(CancellationToken cancellationToken)
{
await Client.ConnectAsync(Options.Soulseek.Username, Options.Soulseek.Password).ConfigureAwait(false);
+ if (UsingProxy)
+ {
+ Logger.Information($"Using Proxy {Options.Soulseek.Connection.Proxy.Address}:{Options.Soulseek.Connection.Proxy.Port}");
+ }
+
Logger.Information("Connected and logged in as {Username}", Options.Soulseek.Username);
Logger.Information("Listening on port {Port}", Options.Soulseek.ListenPort);
Logger.Information("Client started");
@@ -403,7 +414,7 @@ namespace slskd
{
var info = new UserInfo(
description: $"Soulseek.NET Web Example! also, your username is {username}, and IP endpoint is {endpoint}",
- picture: System.IO.File.ReadAllBytes(@"slsk_bird.jpg"),
+ picture: Array.Empty<byte>(),
uploadSlots: 1,
queueLength: 0,
hasFreeUploadSlot: false);