diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-02-05 09:49:46 +0100 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2019-02-05 16:47:50 +0100 |
| commit | 0ef2b46106937c8acbab8e2a6a1e08affb823d31 (patch) | |
| tree | d677d8611a00fb1c7ebe6749b8aaf5e209fa2522 /RSSDP | |
| parent | 52294881b190ad0c4566f46988c5521f6fefabc1 (diff) | |
Remove custom Threading
Diffstat (limited to 'RSSDP')
| -rw-r--r-- | RSSDP/SsdpDeviceLocator.cs | 9 | ||||
| -rw-r--r-- | RSSDP/SsdpDevicePublisher.cs | 9 |
2 files changed, 6 insertions, 12 deletions
diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs index 1348cce8d..128bdfcbb 100644 --- a/RSSDP/SsdpDeviceLocator.cs +++ b/RSSDP/SsdpDeviceLocator.cs @@ -8,7 +8,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; namespace Rssdp.Infrastructure { @@ -23,8 +22,7 @@ namespace Rssdp.Infrastructure private List<DiscoveredSsdpDevice> _Devices; private ISsdpCommunicationsServer _CommunicationsServer; - private ITimer _BroadcastTimer; - private ITimerFactory _timerFactory; + private Timer _BroadcastTimer; private object _timerLock = new object(); private readonly TimeSpan DefaultSearchWaitTime = TimeSpan.FromSeconds(4); @@ -37,12 +35,11 @@ namespace Rssdp.Infrastructure /// <summary> /// Default constructor. /// </summary> - public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory) + public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer) { if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer)); _CommunicationsServer = communicationsServer; - _timerFactory = timerFactory; _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived; _Devices = new List<DiscoveredSsdpDevice>(); @@ -94,7 +91,7 @@ namespace Rssdp.Infrastructure { if (_BroadcastTimer == null) { - _BroadcastTimer = _timerFactory.Create(OnBroadcastTimerCallback, null, dueTime, period); + _BroadcastTimer = new Timer(OnBroadcastTimerCallback, null, dueTime, period); } else { diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 8a73e6a2d..ce64ba117 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -7,7 +7,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Net; -using MediaBrowser.Model.Threading; using Rssdp; namespace Rssdp.Infrastructure @@ -27,8 +26,7 @@ namespace Rssdp.Infrastructure private IList<SsdpRootDevice> _Devices; private IReadOnlyList<SsdpRootDevice> _ReadOnlyDevices; - private ITimer _RebroadcastAliveNotificationsTimer; - private ITimerFactory _timerFactory; + private Timer _RebroadcastAliveNotificationsTimer; private IDictionary<string, SearchRequest> _RecentSearchRequests; @@ -39,7 +37,7 @@ namespace Rssdp.Infrastructure /// <summary> /// Default constructor. /// </summary> - public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory, string osName, string osVersion) + public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, string osName, string osVersion) { if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer)); if (osName == null) throw new ArgumentNullException(nameof(osName)); @@ -48,7 +46,6 @@ namespace Rssdp.Infrastructure if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName)); _SupportPnpRootDevice = true; - _timerFactory = timerFactory; _Devices = new List<SsdpRootDevice>(); _ReadOnlyDevices = new ReadOnlyCollection<SsdpRootDevice>(_Devices); _RecentSearchRequests = new Dictionary<string, SearchRequest>(StringComparer.OrdinalIgnoreCase); @@ -64,7 +61,7 @@ namespace Rssdp.Infrastructure public void StartBroadcastingAliveMessages(TimeSpan interval) { - _RebroadcastAliveNotificationsTimer = _timerFactory.Create(SendAllAliveNotifications, null, TimeSpan.FromSeconds(5), interval); + _RebroadcastAliveNotificationsTimer = new Timer(SendAllAliveNotifications, null, TimeSpan.FromSeconds(5), interval); } /// <summary> |
