aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-06-30 15:27:06 -0400
committerGitHub <noreply@github.com>2016-06-30 15:27:06 -0400
commit2708df6cc28c48a89416bdfbdde7e78fc4227c62 (patch)
tree9f892d6350a4d694c96985d679f622c0f7005278 /MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
parentd9406d48ca0231bc096aeadc595c30f0596c8dda (diff)
parent5bdc96bb6a9b863980661e2d11c1ad00a02eb601 (diff)
Merge pull request #1899 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Server.Implementations/Connect/ConnectManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Connect/ConnectManager.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
index f3d545492..24750de94 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
@@ -139,11 +139,14 @@ namespace MediaBrowser.Server.Implementations.Connect
_securityManager = securityManager;
_fileSystem = fileSystem;
- _config.ConfigurationUpdated += _config_ConfigurationUpdated;
-
LoadCachedData();
}
+ internal void Start()
+ {
+ _config.ConfigurationUpdated += _config_ConfigurationUpdated;
+ }
+
internal void OnWanAddressResolved(IPAddress address)
{
DiscoveredWanIpAddress = address;
@@ -177,7 +180,7 @@ namespace MediaBrowser.Server.Implementations.Connect
try
{
- var localAddress = _appHost.LocalApiUrl;
+ var localAddress = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
var hasExistingRecord = !string.IsNullOrWhiteSpace(ConnectServerId) &&
!string.IsNullOrWhiteSpace(ConnectAccessKey);
@@ -217,24 +220,26 @@ namespace MediaBrowser.Server.Implementations.Connect
}
private string _lastReportedIdentifier;
- private string GetConnectReportingIdentifier()
+ private async Task<string> GetConnectReportingIdentifier()
{
- return GetConnectReportingIdentifier(_appHost.LocalApiUrl, WanApiAddress);
+ var url = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
+ return GetConnectReportingIdentifier(url, WanApiAddress);
}
private string GetConnectReportingIdentifier(string localAddress, string remoteAddress)
{
return (remoteAddress ?? string.Empty) + (localAddress ?? string.Empty);
}
- void _config_ConfigurationUpdated(object sender, EventArgs e)
+ async void _config_ConfigurationUpdated(object sender, EventArgs e)
{
// If info hasn't changed, don't report anything
- if (string.Equals(_lastReportedIdentifier, GetConnectReportingIdentifier(), StringComparison.OrdinalIgnoreCase))
+ var connectIdentifier = await GetConnectReportingIdentifier().ConfigureAwait(false);
+ if (string.Equals(_lastReportedIdentifier, connectIdentifier, StringComparison.OrdinalIgnoreCase))
{
return;
}
- UpdateConnectInfo();
+ await UpdateConnectInfo().ConfigureAwait(false);
}
private async Task CreateServerRegistration(string wanApiAddress, string localAddress)
@@ -357,6 +362,8 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var path = CacheFilePath;
+ _logger.Info("Loading data from {0}", path);
+
try
{
lock (_dataFileLock)