From f7156c08b159875cc3f8b4e59cb3babd8e475cca Mon Sep 17 00:00:00 2001 From: encode42 Date: Sun, 21 Sep 2025 04:28:34 -0400 Subject: Support the ability for the web interface to listen on a unix socket --- src/slskd/Core/Options.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/slskd/Core/Options.cs') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 4d4c1e68..af8f3c2f 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1812,6 +1812,15 @@ namespace slskd [Validate] [RequiresRestart] public HttpsOptions Https { get; init; } = new HttpsOptions(); + + /// + /// Gets the unix listen socket. + /// + [Argument(default, "http-socket")] + [EnvironmentVariable("HTTP_SOCKET")] + [Description("unix listen socket for web UI")] + [RequiresRestart] + public string Socket { get; init; } /// /// Gets the base url for web requests. -- cgit v1.2.3 From 16fdab0d63bae249f32f12112e0745dcd4bdf2eb Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 28 Sep 2025 14:43:42 -0500 Subject: tweak docs, assign validators for socket --- config/slskd.example.yml | 2 +- docs/config.md | 4 +++- src/slskd/Core/Options.cs | 20 +++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'src/slskd/Core/Options.cs') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 122ce4cf..ad3c6113 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -136,6 +136,7 @@ # - ^.{1,2}$ # web: # port: 5030 +# socket: ~ # https: # disabled: false # port: 5031 @@ -143,7 +144,6 @@ # certificate: # pfx: ~ # password: ~ -# socket: ~ # url_base: / # content_path: wwwroot # logging: false diff --git a/docs/config.md b/docs/config.md index 6bbd01cf..10f296f5 100644 --- a/docs/config.md +++ b/docs/config.md @@ -793,6 +793,8 @@ soulseek: The default HTTP listen port is 5030, but can be anything between 1 and 65535. +A [unix domain socket](https://en.wikipedia.org/wiki/Unix_domain_socket) can be used on both unix-like operating systems and Windows. The specified socket file path must be absolute, and must point to a file that does not exist (slskd will manage it automatically). + The URL base option allows the application to operate behind a reverse proxy. Setting a base of "slskd" would make the web UI accessible at `http://:/slskd`. The content path can be used to force the application to serve static web content from a location other than the default (`wwwroot`). The application is designed to decouple the Web UI from the rest of the application to be replaceable. @@ -802,7 +804,7 @@ Logging of HTTP requests is disabled by default. | Command-Line | Environment Variable | Description | | ----------------- | -------------------------- | ------------------------------------------------- | | `-l\|--http-port` | `SLSKD_HTTP_PORT` | The HTTP listen port | -| `--http-socket` | `SLSKD_HTTP_SOCKET` | The unix listen socket | +| `--http-socket` | `SLSKD_HTTP_SOCKET` | The HTTP listen unix domain socket (UDS) path | | `--url-base` | `SLSKD_URL_BASE` | The base url for web requests | | `--content-path` | `SLSKD_CONTENT_PATH` | The path to static web content | | `--http-logging` | `SLSKD_HTTP_LOGGING` | Determines whether HTTP requests are to be logged | diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index af8f3c2f..352d23e9 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1807,21 +1807,23 @@ namespace slskd public int Port { get; init; } = 5030; /// - /// Gets HTTPS options. - /// - [Validate] - [RequiresRestart] - public HttpsOptions Https { get; init; } = new HttpsOptions(); - - /// - /// Gets the unix listen socket. + /// Gets the HTTP listen unix domain socket (UDS) path. /// [Argument(default, "http-socket")] [EnvironmentVariable("HTTP_SOCKET")] - [Description("unix listen socket for web UI")] + [Description("HTTP listen unix domain socket (UDS) path for web UI")] + [FileDoesNotExist] + [AbsoluteFilePath] [RequiresRestart] public string Socket { get; init; } + /// + /// Gets HTTPS options. + /// + [Validate] + [RequiresRestart] + public HttpsOptions Https { get; init; } = new HttpsOptions(); + /// /// Gets the base url for web requests. /// -- cgit v1.2.3 From e1a39de7d5e8127a2a3b52ecc5d09bb4961c40e0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 11 Oct 2025 00:28:41 -0500 Subject: add transfer timeout setting --- config/slskd.example.yml | 1 + docs/config.md | 7 ++++++- src/slskd/Core/Options.cs | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/slskd/Core/Options.cs') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index ad3c6113..419c0c9f 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -207,6 +207,7 @@ # timeout: # connect: 10000 # inactivity: 15000 +# transfer: 30000 # buffer: # read: 16384 # write: 16384 diff --git a/docs/config.md b/docs/config.md index 10f296f5..5a4d3155 100644 --- a/docs/config.md +++ b/docs/config.md @@ -705,10 +705,14 @@ Higher connect timeout values will help ensure that operations (browse, download Inactivity timeouts help the application determine when a distributed parent connection has stopped sending data and when connections that have delivered search results (and are unlikely to be used further) from remaining open longer than needed. Reducing this timeout can help low spec systems if port exhaustion is a concern but may result in the application "hunting" for a distributed parent connection needlessly. +Transfer connections use their own timeout value; other Soulseek clients regulate transfer speed by controlling how often data is sent (e.g. send full speed for 5 seconds, send nothing for 25 seconds), +and as such transfers can easily time out due to inactivity if using a lower value. This setting must be at least 30 seconds. + | Command-Line | Environment Variable | Description | | --------------------------- | ------------------------------- | ------------------------------------------------ | | `--slsk-connection-timeout` | `SLSKD_SLSK_CONNECTION_TIMEOUT` | The connection timeout value, in milliseconds | | `--slsk-inactivity-timeout` | `SLSKD_SLSK_INACTIVITY_TIMEOUT` | The connection inactivity value, in milliseconds | +| `--slsk-transfer-timeout` | `SLSKD_SLSK_TRANSFER_TIMEOUT` | The transfer connection timeout value, in milliseconds | #### **YAML** ```yaml @@ -716,7 +720,8 @@ soulseek: connection: timeout: connect: 10000 - inactivity: 15000 + inactivity: 15000 + transfer: 30000 ``` ### Buffers diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 352d23e9..38416ca2 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1675,6 +1675,15 @@ namespace slskd [Description("connection inactivity timeout, in milliseconds")] [Range(1000, int.MaxValue)] public int Inactivity { get; init; } = 15000; + + /// + /// Gets the transfer connection timeout, in milliseconds. + /// + [Argument(default, "slsk-transfer-timeout")] + [EnvironmentVariable("SLSK_TRANSFER_TIMEOUT")] + [Description("transfer connection timeout, in milliseconds")] + [Range(30_000, int.MaxValue)] + public int Transfer { get; init; } = 60000; } /// -- cgit v1.2.3 From efe4164f73e9c13fdaf099b41a9230b4d87960d9 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 11 Nov 2025 19:30:04 -0600 Subject: add SQLite flags --- src/slskd/Core/Options.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/slskd/Core/Options.cs') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 38416ca2..a569841f 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -461,6 +461,22 @@ namespace slskd [EnvironmentVariable("OPTIMISTIC_RELAY_FILE_INFO")] [Description("use uploaded relay shares as source of truth for file existence and size")] public bool OptimisticRelayFileInfo { get; init; } = false; + + /// + /// Gets a value indicating whether SQLite cache sharing should be disabled (set to Private). + /// + [Argument(default, "no-sqlite-cache-sharing")] + [EnvironmentVariable("NO_SQLITE_CACHE_SHARING")] + [Description("disable SQLite cache sharing")] + public bool NoSqliteCacheSharing { get; init; } = false; + + /// + /// Gets a value indicating whether SQLite pooling should be disabled. + /// + [Argument(default, "no-sqlite-pooling")] + [EnvironmentVariable("NO_SQLITE_POOLING")] + [Description("disable SQLite pooling")] + public bool NoSqlitePooling { get; init; } = false; } /// -- cgit v1.2.3 From e763715bd89cbf8c10537fc72905d4358caf8215 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 16 Nov 2025 18:37:55 -0600 Subject: remove file validation for unix sockets --- src/slskd/Core/Options.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'src/slskd/Core/Options.cs') diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index a569841f..61e2878c 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1837,7 +1837,6 @@ namespace slskd [Argument(default, "http-socket")] [EnvironmentVariable("HTTP_SOCKET")] [Description("HTTP listen unix domain socket (UDS) path for web UI")] - [FileDoesNotExist] [AbsoluteFilePath] [RequiresRestart] public string Socket { get; init; } -- cgit v1.2.3 From 277fed8cdd5187769479eed60754b300b96761eb Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 22 Nov 2025 17:33:00 -0600 Subject: add flag to enable logging of unobserved exceptions --- config/slskd.example.yml | 1 + src/slskd/Core/Options.cs | 9 +++++++++ src/slskd/Program.cs | 15 +++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src/slskd/Core/Options.cs') diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 419c0c9f..a0ca4f3f 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -13,6 +13,7 @@ # force_migrations: false # no_version_check: false # log_sql: false +# log_unobserved_exceptions: false # experimental: false # volatile: false # case_sensitive_reg_ex: false diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 61e2878c..ec94afcb 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -417,6 +417,15 @@ namespace slskd [RequiresRestart] public bool LogSQL { get; init; } = false; + /// + /// Gets a value indicating whether to log unobserved Exceptions. + /// + [Argument(default, "log-unobserved-exceptions")] + [EnvironmentVariable("LOG_UNOBSERVED_EXCEPTIONS")] + [Description("log unobserved exceptions (caution: verbose)")] + [RequiresRestart] + public bool LogUnobservedExceptions { get; init; } = false; + /// /// Gets a value indicating whether the application should run in experimental mode. /// diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index ee9e2d0c..07d08fca 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -1143,12 +1143,15 @@ namespace slskd })) .CreateLogger(); - // // occurs when a faulted task's unobserved exception is about to trigger exception escalation policy, which, by default, would terminate the process. - // TaskScheduler.UnobservedTaskException += (sender, e) => - // { - // Serilog.Log.Logger.Error(e.Exception, "Unobserved exception: {Message}", e.Exception.Message); - // e.SetObserved(); - // }; + if (OptionsAtStartup.Flags.LogUnobservedExceptions) + { + // log Exceptions raised on fired-and-forgotten tasks, which adds very little value but might help debug someday + TaskScheduler.UnobservedTaskException += (sender, e) => + { + Serilog.Log.Logger.Error(e.Exception, "Unobserved exception: {Message}", e.Exception.Message); + e.SetObserved(); + }; + } AppDomain.CurrentDomain.UnhandledException += (sender, e) => { -- cgit v1.2.3