fire DeviceLeft on byebye

This commit is contained in:
Luke Pulverenti 2015-05-04 14:01:01 -04:00
parent fabb4f4c95
commit 50bf2de329

View File

@ -203,18 +203,25 @@ namespace MediaBrowser.Dlna.Ssdp
string nts; string nts;
args.Headers.TryGetValue("NTS", out 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; string usn;
if (!args.Headers.TryGetValue("USN", out usn)) usn = string.Empty; if (!args.Headers.TryGetValue("USN", out usn)) usn = string.Empty;
string nt; string nt;
if (!args.Headers.TryGetValue("NT", out nt)) nt = string.Empty; 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 // Need to be able to download device description
string location; string location;
if (!args.Headers.TryGetValue("Location", out location) || if (!args.Headers.TryGetValue("Location", out location) ||