diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-09-13 13:49:13 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-09-13 13:49:13 -0400 |
| commit | 020ceb97d2335f57ad4d0c796e2d6bf800907337 (patch) | |
| tree | dc545a8a0ef6eed907785f297e9e6f72505b45fb | |
| parent | de2aebd67325a44669635170b01dcf5d94f95f1f (diff) | |
update device discovery
| -rw-r--r-- | MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Connect/ConnectManager.cs | 2 |
2 files changed, 13 insertions, 15 deletions
diff --git a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs index 91dbeb96e..c9bba526a 100644 --- a/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs +++ b/MediaBrowser.Dlna/Ssdp/DeviceDiscovery.cs @@ -50,8 +50,6 @@ namespace MediaBrowser.Dlna.Ssdp // Connect our event handler so we process devices as they are found _DeviceLocator.DeviceAvailable += deviceLocator_DeviceAvailable; _DeviceLocator.DeviceUnavailable += _DeviceLocator_DeviceUnavailable; - // Enable listening for notifications (optional) - _DeviceLocator.StartListeningForNotifications(); // Perform a search so we don't have to wait for devices to broadcast notifications // again to get any results right away (notifications are broadcast periodically). @@ -62,23 +60,23 @@ namespace MediaBrowser.Dlna.Ssdp { Task.Factory.StartNew(async (o) => { - try + while (!_tokenSource.IsCancellationRequested) { - while (true) + try { + // Enable listening for notifications (optional) + _DeviceLocator.StartListeningForNotifications(); + await _DeviceLocator.SearchAsync().ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error searching for devices", ex); + } - var delay = _config.GetDlnaConfiguration().ClientDiscoveryIntervalSeconds * 1000; + 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); + await Task.Delay(delay, _tokenSource.Token).ConfigureAwait(false); } }, CancellationToken.None, TaskCreationOptions.LongRunning); diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index 45cb2f57d..e7e52a887 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -450,7 +450,7 @@ namespace MediaBrowser.Server.Implementations.Connect if (!string.IsNullOrWhiteSpace(user.ConnectUserId)) { - await RemoveConnect(user, connectUser.Id).ConfigureAwait(false); + await RemoveConnect(user, user.ConnectUserId).ConfigureAwait(false); } var url = GetConnectUrl("ServerAuthorizations"); |
