diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-12-04 15:07:56 -0500 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-12-04 15:07:56 -0500 |
| commit | 6819be81601f6a95a60ce2735474ae0015d19bff (patch) | |
| tree | 7e2743455e53d4a028fae789f2fc74a7c5ae87b9 /MediaBrowser.Common.Implementations/BaseApplicationHost.cs | |
| parent | 190be6311fbdf3a73f9c8e330f44edafe7764284 (diff) | |
| parent | cb882a4b48e9cf03cd363c54d93338ad62153e7e (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index ee22b7baa..e8f4d51eb 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -22,7 +22,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; -using System.Net.Http; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -34,7 +33,7 @@ namespace MediaBrowser.Common.Implementations /// </summary> /// <typeparam name="TApplicationPathsType">The type of the T application paths type.</typeparam> public abstract class BaseApplicationHost<TApplicationPathsType> : IApplicationHost - where TApplicationPathsType : class, IApplicationPaths, new() + where TApplicationPathsType : class, IApplicationPaths { /// <summary> /// Occurs when [has pending restart changed]. @@ -84,7 +83,7 @@ namespace MediaBrowser.Common.Implementations /// <summary> /// The json serializer /// </summary> - public readonly IJsonSerializer JsonSerializer = new JsonSerializer(); + public IJsonSerializer JsonSerializer { get; private set; } /// <summary> /// The _XML serializer @@ -154,7 +153,7 @@ namespace MediaBrowser.Common.Implementations protected IInstallationManager InstallationManager { get; private set; } protected IFileSystem FileSystemManager { get; private set; } - + /// <summary> /// Gets or sets the zip client. /// </summary> @@ -182,6 +181,8 @@ namespace MediaBrowser.Common.Implementations /// <returns>Task.</returns> public virtual async Task Init() { + JsonSerializer = CreateJsonSerializer(); + IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted; Logger = LogManager.GetLogger("App"); @@ -213,19 +214,24 @@ namespace MediaBrowser.Common.Implementations } + protected virtual IJsonSerializer CreateJsonSerializer() + { + return new JsonSerializer(); + } + private void SetHttpLimit() { try { // Increase the max http request limit - ServicePointManager.DefaultConnectionLimit = Math.Max(48, ServicePointManager.DefaultConnectionLimit); + ServicePointManager.DefaultConnectionLimit = Math.Max(96, ServicePointManager.DefaultConnectionLimit); } catch (Exception ex) { Logger.ErrorException("Error setting http limit", ex); } } - + /// <summary> /// Installs the iso mounters. /// </summary> @@ -353,7 +359,7 @@ namespace MediaBrowser.Common.Implementations FileSystemManager = CreateFileSystemManager(); RegisterSingleInstance(FileSystemManager); - HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, CreateHttpClient, FileSystemManager); + HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, FileSystemManager); RegisterSingleInstance(HttpClient); NetworkManager = CreateNetworkManager(); @@ -378,8 +384,6 @@ namespace MediaBrowser.Common.Implementations return new CommonFileSystem(Logger, true); } - protected abstract HttpClient CreateHttpClient(bool enableHttpCompression); - /// <summary> /// Gets a list of types within an assembly /// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference |
