From 50bf2de329e80a6eda07315a5a7295dd9bb47ba6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 4 May 2015 14:01:01 -0400 Subject: [PATCH] fire DeviceLeft on byebye --- MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs index 3dd482e647..737eb4287a 100644 --- a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs +++ b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs @@ -203,18 +203,25 @@ namespace MediaBrowser.Dlna.Ssdp string nts; args.Headers.TryGetValue("NTS", out nts); + if (String.Equals(nts, "ssdp:byebye", StringComparison.OrdinalIgnoreCase)) + { + if (String.Equals(args.Method, "NOTIFY", StringComparison.OrdinalIgnoreCase)) + { + if (!_disposed) + { + EventHelper.FireEventIfNotNull(DeviceLeft, this, args, _logger); + } + } + + return; + } + string usn; if (!args.Headers.TryGetValue("USN", out usn)) usn = string.Empty; string nt; if (!args.Headers.TryGetValue("NT", out nt)) nt = string.Empty; - // Ignore when a device is indicating it's shutting down - if (string.Equals(nts, "ssdp:byebye", StringComparison.OrdinalIgnoreCase)) - { - return; - } - // Need to be able to download device description string location; if (!args.Headers.TryGetValue("Location", out location) ||