aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-06-30 01:06:08 -0400
committerGitHub <noreply@github.com>2016-06-30 01:06:08 -0400
commit8f11917e84ed3b09bec10cf46c768dfc377f85d1 (patch)
treeb09ae3063433d4899ac1aae6bd4a6935449cd6a1 /MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
parent808ff8f05477d8a9871ee15bf6070737c810eceb (diff)
parent9a012e458cd12ca7b9630ce7f3074318db9deee8 (diff)
Merge pull request #1894 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
index ea12e332d..28a62c012 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
@@ -41,14 +41,15 @@ namespace MediaBrowser.Server.Implementations.Connect
public void Run()
{
- Task.Run(() => LoadCachedAddress());
+ LoadCachedAddress();
_timer = new PeriodicTimer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3));
+ ((ConnectManager)_connectManager).Start();
}
private readonly string[] _ipLookups =
{
- "http://bot.whatismyipaddress.com",
+ "http://bot.whatismyipaddress.com",
"https://connect.emby.media/service/ip"
};
@@ -78,17 +79,18 @@ namespace MediaBrowser.Server.Implementations.Connect
}
// 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)
{
try
{
- validIpAddress = await GetIpAddress(ipLookupUrl, true).ConfigureAwait(false);
+ var newAddress = await GetIpAddress(ipLookupUrl, true).ConfigureAwait(false);
// Try to find the ipv4 address, if present
- if (validIpAddress.AddressFamily == AddressFamily.InterNetwork)
+ if (newAddress.AddressFamily == AddressFamily.InterNetwork)
{
+ validIpAddress = newAddress;
break;
}
}
@@ -162,6 +164,8 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var path = CacheFilePath;
+ _logger.Info("Loading data from {0}", path);
+
try
{
var endpoint = _fileSystem.ReadAllText(path, Encoding.UTF8);