aboutsummaryrefslogtreecommitdiff
path: root/RSSDP/SsdpDeviceLocatorBase.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-08-27 13:34:55 -0400
committerGitHub <noreply@github.com>2017-08-27 13:34:55 -0400
commitf3ee129bd9e88e8768221ba176bc8356f9b240e3 (patch)
tree72dc082f77629e8d70f764d175433b40ac4c02d0 /RSSDP/SsdpDeviceLocatorBase.cs
parent4f8684a16b1102056bd2b527dcbd585b78dd8000 (diff)
parentfa6bec94b59cf850246c5d0757b9279d080643d7 (diff)
Merge pull request #2847 from MediaBrowser/beta
Beta
Diffstat (limited to 'RSSDP/SsdpDeviceLocatorBase.cs')
-rw-r--r--RSSDP/SsdpDeviceLocatorBase.cs37
1 files changed, 23 insertions, 14 deletions
diff --git a/RSSDP/SsdpDeviceLocatorBase.cs b/RSSDP/SsdpDeviceLocatorBase.cs
index 1adb95cdf..d1eaef88a 100644
--- a/RSSDP/SsdpDeviceLocatorBase.cs
+++ b/RSSDP/SsdpDeviceLocatorBase.cs
@@ -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