diff options
| author | Bond-009 <bond.009@outlook.com> | 2023-10-17 14:31:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-17 14:31:35 +0200 |
| commit | 84bbf757fa5fdf9fef45d9a61e686941e6901ba0 (patch) | |
| tree | 8f02206fad8df92ffd7a5141690e0c960c9615d5 /RSSDP/SsdpDevicePublisher.cs | |
| parent | 59ac5481288bb75b5768d1286038b5c2d3844c78 (diff) | |
| parent | 38d962242ad0b4d3cf10b175836bf1e5e9b60d39 (diff) | |
Merge pull request #10366 from goremykin/fix-resharper-warnings
Diffstat (limited to 'RSSDP/SsdpDevicePublisher.cs')
| -rw-r--r-- | RSSDP/SsdpDevicePublisher.cs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 65ae658a4..0ac9cc9a1 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -243,7 +243,7 @@ namespace Rssdp.Infrastructure } // Do not block synchronously as that may tie up a threadpool thread for several seconds. - Task.Delay(_Random.Next(16, maxWaitInterval * 1000)).ContinueWith((parentTask) => + Task.Delay(_Random.Next(16, maxWaitInterval * 1000), cancellationToken).ContinueWith((parentTask) => { // Copying devices to local array here to avoid threading issues/enumerator exceptions. IEnumerable<SsdpDevice> devices = null; @@ -281,7 +281,7 @@ namespace Rssdp.Infrastructure } } } - }); + }, cancellationToken); } private IEnumerable<SsdpDevice> GetAllDevicesAsFlatEnumerable() @@ -530,10 +530,7 @@ namespace Rssdp.Infrastructure { var timer = _RebroadcastAliveNotificationsTimer; _RebroadcastAliveNotificationsTimer = null; - if (timer is not null) - { - timer.Dispose(); - } + timer?.Dispose(); } private TimeSpan GetMinimumNonZeroCacheLifetime() @@ -567,10 +564,7 @@ namespace Rssdp.Infrastructure private void WriteTrace(string text) { - if (LogFunction is not null) - { - LogFunction(text); - } + LogFunction?.Invoke(text); // System.Diagnostics.Debug.WriteLine(text, "SSDP Publisher"); } |
