mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
improve restart code after port change
This commit is contained in:
parent
baa779fb31
commit
f8263b8b69
@ -201,7 +201,7 @@ namespace MediaBrowser.Common.Implementations
|
||||
|
||||
Task.Run(() => ConfigureAutoRunAtStartup());
|
||||
|
||||
ConfigurationManager.ConfigurationUpdated += ConfigurationManager_ConfigurationUpdated;
|
||||
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
|
||||
});
|
||||
}
|
||||
|
||||
@ -459,7 +459,7 @@ namespace MediaBrowser.Common.Implementations
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
void ConfigurationManager_ConfigurationUpdated(object sender, EventArgs e)
|
||||
protected virtual void OnConfigurationUpdated(object sender, EventArgs e)
|
||||
{
|
||||
ConfigureAutoRunAtStartup();
|
||||
}
|
||||
|
@ -114,6 +114,8 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||
_applicationHost = applicationHost;
|
||||
ConfigurationManager = configurationManager;
|
||||
_kernel = kernel;
|
||||
|
||||
ConfigurationManager.ConfigurationUpdated += ConfigurationUpdated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -127,8 +129,6 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||
{
|
||||
ReloadExternalWebSocketServer();
|
||||
}
|
||||
|
||||
ConfigurationManager.ConfigurationUpdated += ConfigurationUpdated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -352,16 +352,6 @@ namespace MediaBrowser.Server.Implementations.ServerManager
|
||||
void ConfigurationUpdated(object sender, EventArgs e)
|
||||
{
|
||||
HttpServer.EnableHttpRequestLogging = ConfigurationManager.Configuration.EnableHttpLevelLogging;
|
||||
|
||||
if (!string.Equals(HttpServer.UrlPrefix, _kernel.HttpServerUrlPrefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
|
||||
else if (!SupportsNativeWebSocket && ExternalWebSocketServer != null && ExternalWebSocketServer.Port != ConfigurationManager.Configuration.LegacyWebSocketPortNumber)
|
||||
{
|
||||
_applicationHost.NotifyPendingRestart();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -431,6 +431,27 @@ namespace MediaBrowser.ServerApplication
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when [configuration updated].
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
protected override void OnConfigurationUpdated(object sender, EventArgs e)
|
||||
{
|
||||
base.OnConfigurationUpdated(sender, e);
|
||||
|
||||
if (!string.Equals(HttpServer.UrlPrefix, ServerKernel.HttpServerUrlPrefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
NotifyPendingRestart();
|
||||
}
|
||||
|
||||
else if (!ServerManager.SupportsNativeWebSocket && ServerManager.WebSocketPortNumber != ServerConfigurationManager.Configuration.LegacyWebSocketPortNumber)
|
||||
{
|
||||
NotifyPendingRestart();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts this instance.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user