aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/CoreAppHost.cs
blob: 84d78d3fb6c415aa088f0e7b1c3448e837c67ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using System.Reflection;
using Emby.Server.Implementations;
using Emby.Server.Implementations.HttpServer;
using Jellyfin.Server.SocketSharp;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace Jellyfin.Server
{
    public class CoreAppHost : ApplicationHost
    {
        public CoreAppHost(
            ServerApplicationPaths applicationPaths,
            ILoggerFactory loggerFactory,
            StartupOptions options,
            IFileSystem fileSystem,
            IEnvironmentInfo environmentInfo,
            MediaBrowser.Controller.Drawing.IImageEncoder imageEncoder,
            MediaBrowser.Common.Net.INetworkManager networkManager,
            IConfiguration configuration)
            : base(
                applicationPaths,
                loggerFactory,
                options,
                fileSystem,
                environmentInfo,
                imageEncoder,
                networkManager,
                configuration)
        {
        }

        public override bool CanSelfRestart => StartupOptions.RestartPath != null;

        protected override bool SupportsDualModeSockets => true;

        protected override void RestartInternal() => Program.Restart();

        protected override IEnumerable<Assembly> GetAssembliesWithPartsInternal()
        {
            yield return typeof(CoreAppHost).Assembly;
        }

        protected override void ShutdownInternal() => Program.Shutdown();

        protected override IHttpListener CreateHttpListener()
            => new WebSocketSharpListener(
                Logger,
                Certificate,
                StreamHelper,
                NetworkManager,
                SocketFactory,
                CryptographyProvider,
                SupportsDualModeSockets,
                FileSystemManager,
                EnvironmentInfo);
    }
}