aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs')
-rw-r--r--MediaBrowser.Common.Implementations/BaseApplicationHost.cs22
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