|
@@ -44,11 +44,12 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|
LoadCachedAddress();
|
|
LoadCachedAddress();
|
|
|
|
|
|
_timer = new PeriodicTimer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3));
|
|
_timer = new PeriodicTimer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3));
|
|
|
|
+ ((ConnectManager)_connectManager).Start();
|
|
}
|
|
}
|
|
|
|
|
|
private readonly string[] _ipLookups =
|
|
private readonly string[] _ipLookups =
|
|
{
|
|
{
|
|
- "http://bot.whatismyipaddress.com",
|
|
|
|
|
|
+ "http://bot.whatismyipaddress.com",
|
|
"https://connect.emby.media/service/ip"
|
|
"https://connect.emby.media/service/ip"
|
|
};
|
|
};
|
|
|
|
|
|
@@ -78,17 +79,18 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|
}
|
|
}
|
|
|
|
|
|
// If this produced an ipv6 address, try again
|
|
// If this produced an ipv6 address, try again
|
|
- if (validIpAddress == null || validIpAddress.AddressFamily == AddressFamily.InterNetworkV6)
|
|
|
|
|
|
+ if (validIpAddress != null && validIpAddress.AddressFamily == AddressFamily.InterNetworkV6)
|
|
{
|
|
{
|
|
foreach (var ipLookupUrl in _ipLookups)
|
|
foreach (var ipLookupUrl in _ipLookups)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- validIpAddress = await GetIpAddress(ipLookupUrl, true).ConfigureAwait(false);
|
|
|
|
|
|
+ var newAddress = await GetIpAddress(ipLookupUrl, true).ConfigureAwait(false);
|
|
|
|
|
|
// Try to find the ipv4 address, if present
|
|
// Try to find the ipv4 address, if present
|
|
- if (validIpAddress.AddressFamily == AddressFamily.InterNetwork)
|
|
|
|
|
|
+ if (newAddress.AddressFamily == AddressFamily.InterNetwork)
|
|
{
|
|
{
|
|
|
|
+ validIpAddress = newAddress;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|