From 711f58808447765b51367cb4a60581f8b8bb65ff Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 10 Nov 2017 16:22:38 -0500 Subject: [PATCH] 3.2.36.7 --- Emby.Server.Implementations/ApplicationHost.cs | 3 ++- .../Library/LibraryManager.cs | 6 ++++++ .../Net/SocketFactory.cs | 12 +++++++++++- .../Networking/NetworkManager.cs | 18 ++++++++++++------ .../Configuration/XbmcMetadataOptions.cs | 1 - SharedVersion.cs | 2 +- 6 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 2aeb4b9714..745d83eb5f 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -799,7 +799,7 @@ namespace Emby.Server.Implementations protected abstract IConnectManager CreateConnectManager(); protected abstract ISyncManager CreateSyncManager(); - + protected virtual IHttpClient CreateHttpClient() { return new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory, GetDefaultUserAgent); @@ -953,6 +953,7 @@ namespace Emby.Server.Implementations var deviceRepo = new SqliteDeviceRepository(LogManager.GetLogger("DeviceManager"), ServerConfigurationManager, FileSystemManager, JsonSerializer); deviceRepo.Initialize(); DeviceManager = new DeviceManager(deviceRepo, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager); + RegisterSingleInstance(deviceRepo); RegisterSingleInstance(DeviceManager); var newsService = new Emby.Server.Implementations.News.NewsService(ApplicationPaths, JsonSerializer); diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index bd8a095503..5eda986e14 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -709,6 +709,9 @@ namespace Emby.Server.Implementations.Library var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath)); + // In case program data folder was moved + rootFolder.Path = rootFolderPath; + // Add in the plug-in folders foreach (var child in PluginFolderCreators) { @@ -771,6 +774,9 @@ namespace Emby.Server.Implementations.Library tmpItem = (UserRootFolder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath)); } + // In case program data folder was moved + tmpItem.Path = userRootPath; + _userRootFolder = tmpItem; } } diff --git a/Emby.Server.Implementations/Net/SocketFactory.cs b/Emby.Server.Implementations/Net/SocketFactory.cs index f78fbdfd72..bdae1728f9 100644 --- a/Emby.Server.Implementations/Net/SocketFactory.cs +++ b/Emby.Server.Implementations/Net/SocketFactory.cs @@ -196,8 +196,18 @@ namespace Emby.Server.Implementations.Net try { - //retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); + // seeing occasional exceptions thrown on qnap + // System.Net.Sockets.SocketException (0x80004005): Protocol not available retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); + } + catch (SocketException) + { + + } + + try + { + //retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, multicastTimeToLive); var localIp = IPAddress.Any; diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index f8f7da78ae..fbdb5c128c 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -59,7 +59,13 @@ namespace Emby.Server.Implementations.Networking list.AddRange(GetLocalIpAddressesFallback().Result); } - return list.Where(FilterIpAddress).DistinctBy(i => i.ToString()); + var listClone = list.ToList(); + + return list + .OrderBy(i => i.AddressFamily == AddressFamily.InterNetwork ? 0 : 1) + .ThenBy(i => listClone.IndexOf(i)) + .Where(FilterIpAddress) + .DistinctBy(i => i.ToString()); } private bool FilterIpAddress(IPAddress address) @@ -112,10 +118,10 @@ namespace Emby.Server.Implementations.Networking public bool IsInPrivateAddressSpaceAndLocalSubnet(string endpoint) { - var endpointFirstPart = endpoint.Split('.')[0]; - if (endpoint.StartsWith("10.", StringComparison.OrdinalIgnoreCase)) { + var endpointFirstPart = endpoint.Split('.')[0]; + var subnets = GetSubnets(endpointFirstPart); foreach (var subnet_Match in subnets) @@ -217,7 +223,7 @@ namespace Emby.Server.Implementations.Networking } else if (address.AddressFamily == AddressFamily.InterNetworkV6) { - lengthMatch = 10; + lengthMatch = 9; if (IsInPrivateAddressSpace(endpoint)) { return true; @@ -317,7 +323,7 @@ namespace Emby.Server.Implementations.Networking return ipProperties.UnicastAddresses //.Where(i => i.IsDnsEligible) .Select(i => i.Address) - .Where(i => i.AddressFamily == AddressFamily.InterNetwork) + .Where(i => i.AddressFamily == AddressFamily.InterNetwork || i.AddressFamily == AddressFamily.InterNetworkV6) .ToList(); } catch (Exception ex) @@ -337,7 +343,7 @@ namespace Emby.Server.Implementations.Networking // Reverse them because the last one is usually the correct one // It's not fool-proof so ultimately the consumer will have to examine them and decide return host.AddressList - .Where(i => i.AddressFamily == AddressFamily.InterNetwork) + .Where(i => i.AddressFamily == AddressFamily.InterNetwork || i.AddressFamily == AddressFamily.InterNetworkV6) .Reverse(); } diff --git a/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs b/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs index 86eb40b975..de8a59a3d9 100644 --- a/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs +++ b/MediaBrowser.Model/Configuration/XbmcMetadataOptions.cs @@ -18,7 +18,6 @@ namespace MediaBrowser.Model.Configuration SaveImagePathsInNfo = true; EnablePathSubstitution = true; - EnableExtraThumbsDuplication = true; } } } diff --git a/SharedVersion.cs b/SharedVersion.cs index 1505ef0b8b..8ff6f604b4 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.36.6")] +[assembly: AssemblyVersion("3.2.36.7")]