aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ApplicationHost.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-07-06 23:08:52 +0200
committerGitHub <noreply@github.com>2019-07-06 23:08:52 +0200
commit82f041d050f998d20818efff063b6000dfcbf5d2 (patch)
tree3be5cf1a79180c57a5381e26f60d61088a27b49e /Emby.Server.Implementations/ApplicationHost.cs
parent4f17ed961e2756e0c65b1bb0246e7f62a5f44a8a (diff)
parentba551b48e1e1c80192e10b1bb340d974c6b6dee2 (diff)
Merge branch 'master' into release-10.3.z
Diffstat (limited to 'Emby.Server.Implementations/ApplicationHost.cs')
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs83
1 files changed, 19 insertions, 64 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index c64922a93..120aade39 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -156,11 +156,6 @@ namespace Emby.Server.Implementations
public event EventHandler HasPendingRestartChanged;
/// <summary>
- /// Occurs when [application updated].
- /// </summary>
- public event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
-
- /// <summary>
/// Gets a value indicating whether this instance has changes that require the entire application to restart.
/// </summary>
/// <value><c>true</c> if this instance has pending application restart; otherwise, <c>false</c>.</value>
@@ -237,11 +232,6 @@ namespace Emby.Server.Implementations
/// <value>The server configuration manager.</value>
public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
- protected virtual IResourceFileManager CreateResourceFileManager()
- {
- return new ResourceFileManager(HttpResultFactory, LoggerFactory, FileSystemManager);
- }
-
/// <summary>
/// Gets or sets the user manager.
/// </summary>
@@ -621,8 +611,6 @@ namespace Emby.Server.Implementations
DiscoverTypes();
- SetHttpLimit();
-
await RegisterResources(serviceCollection).ConfigureAwait(false);
FindParts();
@@ -765,10 +753,6 @@ namespace Emby.Server.Implementations
UserDataManager = new UserDataManager(LoggerFactory, ServerConfigurationManager, () => UserManager);
serviceCollection.AddSingleton(UserDataManager);
- UserRepository = GetUserRepository();
- // This is only needed for disposal purposes. If removing this, make sure to have the manager handle disposing it
- serviceCollection.AddSingleton(UserRepository);
-
var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory, JsonSerializer, ApplicationPaths, FileSystemManager);
serviceCollection.AddSingleton<IDisplayPreferencesRepository>(displayPreferencesRepo);
@@ -778,6 +762,8 @@ namespace Emby.Server.Implementations
AuthenticationRepository = GetAuthenticationRepository();
serviceCollection.AddSingleton(AuthenticationRepository);
+ UserRepository = GetUserRepository();
+
UserManager = new UserManager(LoggerFactory, ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager);
serviceCollection.AddSingleton(UserManager);
@@ -818,7 +804,6 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton(TVSeriesManager);
DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager);
-
serviceCollection.AddSingleton(DeviceManager);
MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, () => MediaEncoder);
@@ -833,10 +818,10 @@ namespace Emby.Server.Implementations
DtoService = new DtoService(LoggerFactory, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ProviderManager, this, () => MediaSourceManager, () => LiveTvManager);
serviceCollection.AddSingleton(DtoService);
- ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
+ ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, ProviderManager);
serviceCollection.AddSingleton(ChannelManager);
- SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager);
+ SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, this, AuthenticationRepository, DeviceManager, MediaSourceManager);
serviceCollection.AddSingleton(SessionManager);
serviceCollection.AddSingleton<IDlnaManager>(
@@ -893,7 +878,7 @@ namespace Emby.Server.Implementations
SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory, ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory);
serviceCollection.AddSingleton(SubtitleEncoder);
- serviceCollection.AddSingleton(CreateResourceFileManager());
+ serviceCollection.AddSingleton(typeof(IResourceFileManager), typeof(ResourceFileManager));
displayPreferencesRepo.Initialize();
@@ -918,8 +903,7 @@ namespace Emby.Server.Implementations
.Distinct();
logger.LogInformation("Arguments: {Args}", commandLineArgs);
- // FIXME: @bond this logs the kernel version, not the OS version
- logger.LogInformation("Operating system: {OS} {OSVersion}", OperatingSystem.Name, Environment.OSVersion.Version);
+ logger.LogInformation("Operating system: {OS}", OperatingSystem.Name);
logger.LogInformation("Architecture: {Architecture}", RuntimeInformation.OSArchitecture);
logger.LogInformation("64-Bit Process: {Is64Bit}", Environment.Is64BitProcess);
logger.LogInformation("User Interactive: {IsUserInteractive}", Environment.UserInteractive);
@@ -929,19 +913,6 @@ namespace Emby.Server.Implementations
logger.LogInformation("Application directory: {ApplicationPath}", appPaths.ProgramSystemPath);
}
- private void SetHttpLimit()
- {
- try
- {
- // Increase the max http request limit
- ServicePointManager.DefaultConnectionLimit = Math.Max(96, ServicePointManager.DefaultConnectionLimit);
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "Error setting http limit");
- }
- }
-
private X509Certificate2 GetCertificate(CertificateInfo info)
{
var certificateLocation = info?.Path;
@@ -1035,7 +1006,6 @@ namespace Emby.Server.Implementations
Video.LiveTvManager = LiveTvManager;
Folder.UserViewManager = UserViewManager;
UserView.TVSeriesManager = TVSeriesManager;
- UserView.PlaylistManager = PlaylistManager;
UserView.CollectionManager = CollectionManager;
BaseItem.MediaSourceManager = MediaSourceManager;
CollectionFolder.XmlSerializer = XmlSerializer;
@@ -1441,9 +1411,9 @@ namespace Emby.Server.Implementations
public async Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken)
{
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
-
- string wanAddress;
-
+
+ string wanAddress;
+
if (string.IsNullOrEmpty(ServerConfigurationManager.Configuration.WanDdns))
{
wanAddress = await GetWanApiUrlFromExternal(cancellationToken).ConfigureAwait(false);
@@ -1499,10 +1469,10 @@ namespace Emby.Server.Implementations
public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
{
- var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
-
+ var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
+
string wanAddress;
-
+
if (string.IsNullOrEmpty(ServerConfigurationManager.Configuration.WanDdns))
{
wanAddress = await GetWanApiUrlFromExternal(cancellationToken).ConfigureAwait(false);
@@ -1572,6 +1542,7 @@ namespace Emby.Server.Implementations
{
Logger.LogError(ex, "Error getting WAN Ip address information");
}
+
return null;
}
@@ -1618,9 +1589,9 @@ namespace Emby.Server.Implementations
}
return string.Format("http://{0}:{1}",
host,
- ServerConfigurationManager.Configuration.PublicPort.ToString(CultureInfo.InvariantCulture));
+ ServerConfigurationManager.Configuration.PublicPort.ToString(CultureInfo.InvariantCulture));
}
-
+
public Task<List<IpAddressInfo>> GetLocalIpAddresses(CancellationToken cancellationToken)
{
return GetLocalIpAddressesInternal(true, 0, cancellationToken);
@@ -1718,10 +1689,8 @@ namespace Emby.Server.Implementations
LogErrors = LogPing,
LogRequest = LogPing,
BufferContent = false,
-
CancellationToken = cancellationToken
}, HttpMethod.Post).ConfigureAwait(false))
-
{
using (var reader = new StreamReader(response.Content))
{
@@ -1874,24 +1843,6 @@ namespace Emby.Server.Implementations
{
}
- /// <summary>
- /// Called when [application updated].
- /// </summary>
- /// <param name="package">The package.</param>
- protected void OnApplicationUpdated(PackageVersionInfo package)
- {
- Logger.LogInformation("Application has been updated to version {0}", package.versionStr);
-
- ApplicationUpdated?.Invoke(
- this,
- new GenericEventArgs<PackageVersionInfo>()
- {
- Argument = package
- });
-
- NotifyPendingRestart();
- }
-
private bool _disposed = false;
/// <summary>
@@ -1936,8 +1887,12 @@ namespace Emby.Server.Implementations
Logger.LogError(ex, "Error disposing {Type}", part.GetType().Name);
}
}
+
+ UserRepository.Dispose();
}
+ UserRepository = null;
+
_disposed = true;
}
}