update active recordings

This commit is contained in:
Luke Pulverenti
2017-08-24 15:52:19 -04:00
parent 5e0f8fd8c4
commit e441e2f53d
157 changed files with 568 additions and 654 deletions

View File

@@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure
}
catch (Exception ex)
{
}
}
@@ -543,17 +543,9 @@ namespace Rssdp.Infrastructure
}
}
private IEnumerable<DiscoveredSsdpDevice> GetUnexpiredDevices()
{
lock (_Devices)
{
return (from device in _Devices where !device.IsExpired() select device).ToArray();
}
}
private bool DeviceDied(string deviceUsn, bool expired)
{
IEnumerable<DiscoveredSsdpDevice> existingDevices = null;
List<DiscoveredSsdpDevice> existingDevices = null;
lock (_Devices)
{
existingDevices = FindExistingDeviceNotifications(_Devices, deviceUsn);
@@ -565,7 +557,7 @@ namespace Rssdp.Infrastructure
}
}
if (existingDevices != null && existingDevices.Any())
if (existingDevices != null && existingDevices.Count > 0)
{
foreach (var removedDevice in existingDevices)
{
@@ -591,12 +583,29 @@ namespace Rssdp.Infrastructure
private static DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn)
{
return (from d in devices where d.NotificationType == notificationType && d.Usn == usn select d).FirstOrDefault();
foreach (var d in devices)
{
if (d.NotificationType == notificationType && d.Usn == usn)
{
return d;
}
}
return null;
}
private static IEnumerable<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn)
private static List<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn)
{
return (from d in devices where d.Usn == usn select d).ToArray();
var list = new List<DiscoveredSsdpDevice>();
foreach (var d in devices)
{
if (d.Usn == usn)
{
list.Add(d);
}
}
return list;
}
#endregion