diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-09-13 13:49:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-13 13:49:47 -0400 |
| commit | d258ce107db661d33b048986eeacaba24ad746e3 (patch) | |
| tree | b0c165be7302f78c62cb8d73b5d02085b69e3238 /MediaBrowser.Server.Startup.Common | |
| parent | 7ff1bf099f59da506dca43e1cc35061297ae1dd0 (diff) | |
| parent | 020ceb97d2335f57ad4d0c796e2d6bf800907337 (diff) | |
Merge pull request #2168 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 24 | ||||
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/INativeApp.cs | 7 |
2 files changed, 13 insertions, 18 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 3c8c5bf55..f5419e5cf 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -561,8 +561,6 @@ namespace MediaBrowser.Server.Startup.Common EncodingManager = new EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager); RegisterSingleInstance(EncodingManager); - RegisterSingleInstance(NativeApp.GetPowerManagement()); - var sharingRepo = new SharingRepository(LogManager, ApplicationPaths, NativeApp.GetDbConnector()); await sharingRepo.Initialize().ConfigureAwait(false); RegisterSingleInstance<ISharingManager>(new SharingManager(sharingRepo, ServerConfigurationManager, LibraryManager, this)); @@ -1177,20 +1175,24 @@ namespace MediaBrowser.Server.Startup.Common public async Task<List<IPAddress>> GetLocalIpAddresses() { - var localAddresses = NetworkManager.GetLocalIpAddresses() - .Where(IsIpAddressValid) - .ToList(); + var addresses = NetworkManager.GetLocalIpAddresses().ToList(); + var list = new List<IPAddress>(); + + foreach (var address in addresses) + { + var valid = await IsIpAddressValidAsync(address).ConfigureAwait(false); + if (valid) + { + list.Add(address); + } + } - return localAddresses; + return list; } private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase); private DateTime _lastAddressCacheClear; - private bool IsIpAddressValid(IPAddress address) - { - return IsIpAddressValidInternal(address).Result; - } - private async Task<bool> IsIpAddressValidInternal(IPAddress address) + private async Task<bool> IsIpAddressValidAsync(IPAddress address) { if (IPAddress.IsLoopback(address)) { diff --git a/MediaBrowser.Server.Startup.Common/INativeApp.cs b/MediaBrowser.Server.Startup.Common/INativeApp.cs index 9297a6d37..bf8314d13 100644 --- a/MediaBrowser.Server.Startup.Common/INativeApp.cs +++ b/MediaBrowser.Server.Startup.Common/INativeApp.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.Reflection; -using MediaBrowser.Controller.Power; using MediaBrowser.Server.Implementations.Persistence; using MediaBrowser.Server.Startup.Common.FFMpeg; @@ -98,12 +97,6 @@ namespace MediaBrowser.Server.Startup.Common void AllowSystemStandby(); - /// <summary> - /// Gets the power management. - /// </summary> - /// <returns>IPowerManagement.</returns> - IPowerManagement GetPowerManagement(); - FFMpegInstallInfo GetFfmpegInstallInfo(); void LaunchUrl(string url); |
