The Free Software Media System - Server Backend & API
Use DI for ConnectionManagerService
Patrick Barrone0b089a37573
diff --git a/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs b/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.csindex c28a5618ce..f8ed00aeaf 100644--- a/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs+++ b/Emby.Dlna/Extensions/DlnaServiceCollectionExtensions.cs@@ -3,6 +3,7 @@ using System.Globalization;using System.Net;using System.Net.Http;using System.Text;+using Emby.Dlna.ConnectionManager;using Emby.Dlna.ContentDirectory;using Emby.Dlna.Ssdp;using MediaBrowser.Common.Net;@@ -50,5 +51,6 @@ public static class DlnaServiceCollectionExtensionsservices.AddSingleton<IDlnaManager, DlnaManager>();services.AddSingleton<IDeviceDiscovery, DeviceDiscovery>();services.AddSingleton<IContentDirectory, ContentDirectoryService>();+ services.AddSingleton<IConnectionManager, ConnectionManagerService>();}}diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.csindex b2d2f36986..a22143ae7b 100644--- a/Emby.Dlna/Main/DlnaEntryPoint.cs+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs@@ -94,12 +94,6 @@ namespace Emby.Dlna.Main_networkManager = networkManager;_logger = loggerFactory.CreateLogger<DlnaEntryPoint>();- ConnectionManager = new ConnectionManager.ConnectionManagerService(- dlnaManager,- config,- loggerFactory.CreateLogger<ConnectionManager.ConnectionManagerService>(),- httpClientFactory);-MediaReceiverRegistrar = new MediaReceiverRegistrar.MediaReceiverRegistrarService(loggerFactory.CreateLogger<MediaReceiverRegistrar.MediaReceiverRegistrarService>(),httpClientFactory,@@ -122,8 +116,6 @@ namespace Emby.Dlna.Main/// </summary>public static bool Enabled { get; private set; }- public IConnectionManager ConnectionManager { get; private set; }-public IMediaReceiverRegistrar MediaReceiverRegistrar { get; private set; }public async Task RunAsync()@@ -433,7 +425,6 @@ namespace Emby.Dlna.Main_communicationsServer = null;}- ConnectionManager = null;MediaReceiverRegistrar = null;Current = null;diff --git a/Jellyfin.Api/Controllers/DlnaServerController.cs b/Jellyfin.Api/Controllers/DlnaServerController.csindex 178ba6d6e1..2d52097c04 100644--- a/Jellyfin.Api/Controllers/DlnaServerController.cs+++ b/Jellyfin.Api/Controllers/DlnaServerController.cs@@ -34,11 +34,15 @@ public class DlnaServerController : BaseJellyfinApiController/// </summary>/// <param name="dlnaManager">Instance of the <see cref="IDlnaManager"/> interface.</param>/// <param name="contentDirectory">Instance of the <see cref="IContentDirectory"/> interface.</param>- public DlnaServerController(IDlnaManager dlnaManager, IContentDirectory contentDirectory)+ /// <param name="connectionManager">Instance of the <see cref="IConnectionManager"/> interface.</param>+ public DlnaServerController(+ IDlnaManager dlnaManager,+ IContentDirectory contentDirectory,+ IConnectionManager connectionManager){_dlnaManager = dlnaManager;_contentDirectory = contentDirectory;- _connectionManager = DlnaEntryPoint.Current.ConnectionManager;+ _connectionManager = connectionManager;_mediaReceiverRegistrar = DlnaEntryPoint.Current.MediaReceiverRegistrar;}