ipv6 fixes

This commit is contained in:
Luke Pulverenti
2016-03-09 12:40:29 -05:00
parent c3ad2c47db
commit aa23da0dc4
5 changed files with 34 additions and 10 deletions

View File

@@ -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)