Sfoglia il codice sorgente

Fixed false starts

BaronGreenback 4 anni fa
parent
commit
1dd6036765
2 ha cambiato i file con 7 aggiunte e 6 eliminazioni
  1. 1 1
      Emby.Dlna/Ssdp/DeviceDiscovery.cs
  2. 6 5
      RSSDP/SsdpDeviceLocator.cs

+ 1 - 1
Emby.Dlna/Ssdp/DeviceDiscovery.cs

@@ -69,7 +69,7 @@ namespace Emby.Dlna.Ssdp
         {
             lock (_syncLock)
             {
-                if (_listenerCount > 0 && _deviceLocator == null)
+                if (_listenerCount > 0 && _deviceLocator == null && _commsServer != null)
                 {
                     _deviceLocator = new SsdpDeviceLocator(_commsServer);
 

+ 6 - 5
RSSDP/SsdpDeviceLocator.cs

@@ -27,14 +27,15 @@ namespace Rssdp.Infrastructure
         /// </summary>
         public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer)
         {
-            _CommunicationsServer = communicationsServer;
-
-            if (communicationsServer != null)
+            if (communicationsServer == null)
             {
-                // This can occur is dlna is enabled, but defined to run over https.
-                _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;
+                throw new ArgumentNullException(nameof(communicationsServer));
             }
+            
+            _CommunicationsServer = communicationsServer;
 
+            // This can occur is dlna is enabled, but defined to run over https.
+            _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;
             _Devices = new List<DiscoveredSsdpDevice>();
         }