diff --git a/Emby.Server.Implementations/ConfigurationOptions.cs b/Emby.Server.Implementations/ConfigurationOptions.cs index f0c2676279..28897fd54b 100644 --- a/Emby.Server.Implementations/ConfigurationOptions.cs +++ b/Emby.Server.Implementations/ConfigurationOptions.cs @@ -19,7 +19,8 @@ namespace Emby.Server.Implementations { FfmpegAnalyzeDurationKey, "200M" }, { PlaylistsAllowDuplicatesKey, bool.FalseString }, { BindToUnixSocketKey, bool.FalseString }, - { SqliteCacheSizeKey, "20000" } + { SqliteCacheSizeKey, "20000" }, + { DetectNetworkChangeKey, bool.TrueString } }; } } diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs index c3989751ca..91ac827ca6 100644 --- a/Jellyfin.Server/StartupOptions.cs +++ b/Jellyfin.Server/StartupOptions.cs @@ -67,6 +67,12 @@ namespace Jellyfin.Server [Option("published-server-url", Required = false, HelpText = "Jellyfin Server URL to publish via auto discover process")] public string? PublishedServerUrl { get; set; } + /// + /// Gets or sets a value indicating whether the server should not detect network status change. + /// + [Option("nonetchange", Required = false, HelpText = "Indicates that the server should not detect network status change.")] + public bool NoDetectNetworkChange { get; set; } + /// /// Gets the command line options as a dictionary that can be used in the .NET configuration system. /// @@ -90,6 +96,11 @@ namespace Jellyfin.Server config.Add(FfmpegPathKey, FFmpegPath); } + if (NoDetectNetworkChange) + { + config.Add(DetectNetworkChangeKey, bool.FalseString); + } + return config; } } diff --git a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs index 6c58064ce9..6977c6c59e 100644 --- a/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs +++ b/MediaBrowser.Controller/Extensions/ConfigurationExtensions.cs @@ -64,6 +64,11 @@ namespace MediaBrowser.Controller.Extensions /// public const string SqliteCacheSizeKey = "sqlite:cacheSize"; + /// + /// The key for a setting that indicates whether the application should detect network status change. + /// + public const string DetectNetworkChangeKey = "DetectNetworkChange"; + /// /// Gets a value indicating whether the application should host static web content from the . /// diff --git a/src/Jellyfin.Networking/Manager/NetworkManager.cs b/src/Jellyfin.Networking/Manager/NetworkManager.cs index 1da44b0484..1e6085683b 100644 --- a/src/Jellyfin.Networking/Manager/NetworkManager.cs +++ b/src/Jellyfin.Networking/Manager/NetworkManager.cs @@ -98,10 +98,15 @@ public class NetworkManager : INetworkManager, IDisposable _networkEventLock = new object(); _remoteAddressFilter = new List(); + var detectNetworkChange = startupConfig[DetectNetworkChangeKey] == bool.TrueString; + UpdateSettings(_configurationManager.GetNetworkConfiguration()); - NetworkChange.NetworkAddressChanged += OnNetworkAddressChanged; - NetworkChange.NetworkAvailabilityChanged += OnNetworkAvailabilityChanged; + if (detectNetworkChange) + { + NetworkChange.NetworkAddressChanged += OnNetworkAddressChanged; + NetworkChange.NetworkAvailabilityChanged += OnNetworkAvailabilityChanged; + } _configurationManager.NamedConfigurationUpdated += ConfigurationUpdated; }