diff options
Diffstat (limited to 'Emby.Dlna/Ssdp/DeviceDiscovery.cs')
| -rw-r--r-- | Emby.Dlna/Ssdp/DeviceDiscovery.cs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs index 3f0e070ca..7852669c9 100644 --- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs +++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs @@ -75,16 +75,20 @@ namespace Emby.Dlna.Ssdp // Enable listening for notifications (optional) _deviceLocator.StartListeningForNotifications(); - await _deviceLocator.SearchAsync().ConfigureAwait(false); + await _deviceLocator.SearchAsync(_tokenSource.Token).ConfigureAwait(false); + + var delay = _config.GetDlnaConfiguration().ClientDiscoveryIntervalSeconds * 1000; + + await Task.Delay(delay, _tokenSource.Token).ConfigureAwait(false); + } + catch (OperationCanceledException) + { + } catch (Exception ex) { _logger.ErrorException("Error searching for devices", ex); } - - var delay = _config.GetDlnaConfiguration().ClientDiscoveryIntervalSeconds * 1000; - - await Task.Delay(delay, _tokenSource.Token).ConfigureAwait(false); } }, CancellationToken.None, TaskCreationOptions.LongRunning); |
