diff --git a/Emby.Common.Implementations/Net/UdpSocket.cs b/Emby.Common.Implementations/Net/UdpSocket.cs index b2af9d162e..e4b0c7d6dc 100644 --- a/Emby.Common.Implementations/Net/UdpSocket.cs +++ b/Emby.Common.Implementations/Net/UdpSocket.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Net; using System.Net.Sockets; using System.Security; +using System.Threading; using System.Threading.Tasks; using Emby.Common.Implementations.Networking; using MediaBrowser.Model.Net; @@ -56,7 +57,7 @@ namespace Emby.Common.Implementations.Net state.TaskCompletionSource = tcs; #if NETSTANDARD1_6 - _Socket.ReceiveFromAsync(new ArraySegment(state.Buffer),SocketFlags.None, state.RemoteEndPoint) + _Socket.ReceiveFromAsync(new ArraySegment(state.Buffer), SocketFlags.None, state.RemoteEndPoint) .ContinueWith((task, asyncState) => { if (task.Status != TaskStatus.Faulted) @@ -73,7 +74,7 @@ namespace Emby.Common.Implementations.Net return tcs.Task; } - public Task SendAsync(byte[] buffer, int size, IpEndPointInfo endPoint) + public Task SendAsync(byte[] buffer, int size, IpEndPointInfo endPoint, CancellationToken cancellationToken) { ThrowIfDisposed(); @@ -91,6 +92,8 @@ namespace Emby.Common.Implementations.Net buffer = copy; } + cancellationToken.ThrowIfCancellationRequested(); + _Socket.SendTo(buffer, ipEndPoint); return Task.FromResult(true); #else @@ -100,6 +103,11 @@ namespace Emby.Common.Implementations.Net { _Socket.BeginSendTo(buffer, 0, size, SocketFlags.None, ipEndPoint, result => { + if (cancellationToken.IsCancellationRequested) + { + taskSource.TrySetCanceled(); + return; + } try { _Socket.EndSend(result); diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index ca4c3b9122..d048dcde13 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -646,11 +646,6 @@ namespace Emby.Dlna.Didl { var desc = item.Overview; - if (!string.IsNullOrEmpty(item.ShortOverview)) - { - desc = item.ShortOverview; - } - if (!string.IsNullOrWhiteSpace(desc)) { AddValue(writer, "dc", "description", desc, NS_DC); diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs index 3f0e070cac..7852669c9d 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); diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index b9412d0fbb..a3c228a58c 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -413,41 +413,41 @@ namespace Emby.Server.Core var result = new JsonSerializer(FileSystemManager, LogManager.GetLogger("JsonSerializer")); - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "Artists", "AlbumArtists", "ChannelMediaSources", "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" }; - ServiceStack.Text.JsConfig.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" }; - ServiceStack.Text.JsConfig