|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
|
using MediaBrowser.Controller.Connect;
|
|
|
|
|
using MediaBrowser.Controller.Plugins;
|
|
|
|
@ -38,13 +39,17 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|
|
|
|
_timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly string[] _ipLookups = { "http://bot.whatismyipaddress.com", "https://connect.mediabrowser.tv/service/ip" };
|
|
|
|
|
|
|
|
|
|
private async void TimerCallback(object state)
|
|
|
|
|
{
|
|
|
|
|
foreach (var ipLookupUrl in _ipLookups)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (var stream = await _httpClient.Get(new HttpRequestOptions
|
|
|
|
|
{
|
|
|
|
|
Url = "http://bot.whatismyipaddress.com/"
|
|
|
|
|
Url = ipLookupUrl
|
|
|
|
|
|
|
|
|
|
}).ConfigureAwait(false))
|
|
|
|
|
{
|
|
|
|
@ -56,6 +61,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|
|
|
|
{
|
|
|
|
|
((ConnectManager)_connectManager).OnWanAddressResolved(address);
|
|
|
|
|
CacheAddress(address);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -68,6 +74,7 @@ namespace MediaBrowser.Server.Implementations.Connect
|
|
|
|
|
_logger.ErrorException("Error getting connection info", ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string CacheFilePath
|
|
|
|
|
{
|
|
|
|
|