aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs8
-rw-r--r--Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs11
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs8
-rw-r--r--Emby.Server.Implementations/Sync/SyncRepository.cs9
-rw-r--r--Emby.Server.Implementations/Udp/UdpServer.cs13
5 files changed, 36 insertions, 13 deletions
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 4e7dc8836..322cdf4f0 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -275,7 +275,9 @@ namespace Emby.Server.Implementations.HttpServer
{
if (_listener != null)
{
+ _logger.Info("Stopping HttpListener...");
_listener.Stop();
+ _logger.Info("HttpListener stopped");
}
}
@@ -713,19 +715,19 @@ namespace Emby.Server.Implementations.HttpServer
protected virtual void Dispose(bool disposing)
{
if (_disposed) return;
+
base.Dispose();
lock (_disposeLock)
{
if (_disposed) return;
+ _disposed = true;
+
if (disposing)
{
Stop();
}
-
- //release unmanaged resources here...
- _disposed = true;
}
}
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 2e69cd2ef..d782f5b88 100644
--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -9,6 +9,7 @@ using System.Linq;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Logging;
namespace Emby.Server.Implementations.Library
{
@@ -19,6 +20,7 @@ namespace Emby.Server.Implementations.Library
{
private readonly IFileSystem _fileSystem;
private readonly ILibraryManager _libraryManager;
+ private readonly ILogger _logger;
/// <summary>
/// Any folder named in this list will be ignored - can be added to at runtime for extensibility
@@ -40,10 +42,11 @@ namespace Emby.Server.Implementations.Library
};
- public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager)
+ public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager, ILogger logger)
{
_fileSystem = fileSystem;
_libraryManager = libraryManager;
+ _logger = logger;
}
/// <summary>
@@ -54,6 +57,12 @@ namespace Emby.Server.Implementations.Library
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
{
+ // Don't ignore top level folders
+ if (fileInfo.IsDirectory && parent is AggregateFolder)
+ {
+ return false;
+ }
+
var filename = fileInfo.Name;
var isHidden = fileInfo.IsHidden;
var path = fileInfo.FullName;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
index 6d527c1cf..ef440899c 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
@@ -34,7 +34,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var httpRequestOptions = new HttpRequestOptions
{
Url = mediaSource.Path,
- BufferContent = false
+ BufferContent = false,
+
+ // Some remote urls will expect a user agent to be supplied
+ UserAgent = "Emby/3.0",
+
+ // Shouldn't matter but may cause issues
+ EnableHttpCompression = false
};
using (var response = await _httpClient.SendAsync(httpRequestOptions, "GET").ConfigureAwait(false))
diff --git a/Emby.Server.Implementations/Sync/SyncRepository.cs b/Emby.Server.Implementations/Sync/SyncRepository.cs
index 6d4fce399..ad4222ba6 100644
--- a/Emby.Server.Implementations/Sync/SyncRepository.cs
+++ b/Emby.Server.Implementations/Sync/SyncRepository.cs
@@ -244,14 +244,7 @@ namespace Emby.Server.Implementations.Sync
statement.TryBind("@Progress", job.Progress);
statement.TryBind("@UserId", job.UserId);
- if (job.RequestedItemIds.Count > 0)
- {
- statement.TryBind("@ItemIds", string.Join(",", job.RequestedItemIds.ToArray()));
- }
- else
- {
- statement.TryBindNull("@ItemIds");
- }
+ statement.TryBind("@ItemIds", string.Join(",", job.RequestedItemIds.ToArray()));
if (job.Category.HasValue)
{
diff --git a/Emby.Server.Implementations/Udp/UdpServer.cs b/Emby.Server.Implementations/Udp/UdpServer.cs
index c15e0ee41..79a1e4640 100644
--- a/Emby.Server.Implementations/Udp/UdpServer.cs
+++ b/Emby.Server.Implementations/Udp/UdpServer.cs
@@ -154,6 +154,9 @@ namespace Emby.Server.Implementations.Udp
catch (ObjectDisposedException)
{
}
+ catch (OperationCanceledException)
+ {
+ }
catch (Exception ex)
{
_logger.ErrorException("Error receiving udp message", ex);
@@ -167,6 +170,11 @@ namespace Emby.Server.Implementations.Udp
/// <param name="message">The message.</param>
private void OnMessageReceived(SocketReceiveResult message)
{
+ if (_isDisposed)
+ {
+ return;
+ }
+
if (message.RemoteEndPoint.Port == 0)
{
return;
@@ -221,6 +229,11 @@ namespace Emby.Server.Implementations.Udp
public async Task SendAsync(byte[] bytes, IpEndPointInfo remoteEndPoint)
{
+ if (_isDisposed)
+ {
+ throw new ObjectDisposedException(GetType().Name);
+ }
+
if (bytes == null)
{
throw new ArgumentNullException("bytes");