diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-09 12:40:29 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-09 12:40:29 -0500 |
| commit | aa23da0dc44afbfe47a83d2dda0644472ad4e0e4 (patch) | |
| tree | 43ed88904604726e925241788d1e0a684954ff01 /MediaBrowser.Server.Startup.Common | |
| parent | c3ad2c47db05b232bdcd43694645d4cd8c600a99 (diff) | |
ipv6 fixes
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
| -rw-r--r-- | MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index b71fe365d..269c30669 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -97,6 +97,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Net.Sockets; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -322,7 +323,7 @@ namespace MediaBrowser.Server.Startup.Common { TaskManager.SuspendTriggers = true; } - + await base.RunStartupTasks().ConfigureAwait(false); Logger.Info("ServerId: {0}", SystemId); @@ -1134,7 +1135,7 @@ namespace MediaBrowser.Server.Startup.Common if (address != null) { - return GetLocalApiUrl(address.ToString()); + return GetLocalApiUrl(address); } return null; @@ -1148,6 +1149,16 @@ namespace MediaBrowser.Server.Startup.Common } } + public string GetLocalApiUrl(IPAddress ipAddress) + { + if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6) + { + return GetLocalApiUrl("[" + ipAddress + "]"); + } + + return GetLocalApiUrl(ipAddress.ToString()); + } + public string GetLocalApiUrl(string host) { return string.Format("http://{0}:{1}", @@ -1180,7 +1191,7 @@ namespace MediaBrowser.Server.Startup.Common return true; } - var apiUrl = GetLocalApiUrl(address.ToString()); + var apiUrl = GetLocalApiUrl(address); apiUrl += "/system/ping"; if ((DateTime.UtcNow - _lastAddressCacheClear).TotalMinutes >= 5) |
