diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-01-09 15:28:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-09 15:28:12 -0500 |
| commit | 488e36811df4de3a9d75333bc7b73d6ec2eb6ed9 (patch) | |
| tree | 123cfd54e289f98c75c7b722f2bda548c00ae6a2 /Emby.Server.Implementations/Connect/ConnectEntryPoint.cs | |
| parent | d9dda3b56e4269e074379dee134130feab76ad04 (diff) | |
| parent | 85cd90d6e6bb022469cbb34248300f3164cf1775 (diff) | |
Merge pull request #2390 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Connect/ConnectEntryPoint.cs')
| -rw-r--r-- | Emby.Server.Implementations/Connect/ConnectEntryPoint.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs b/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs index 7f15f20cb..b5639773b 100644 --- a/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -18,6 +18,7 @@ namespace Emby.Server.Implementations.Connect public class ConnectEntryPoint : IServerEntryPoint { private ITimer _timer; + private IpAddressInfo _cachedIpAddress; private readonly IHttpClient _httpClient; private readonly IApplicationPaths _appPaths; private readonly ILogger _logger; @@ -151,6 +152,12 @@ namespace Emby.Server.Implementations.Connect private void CacheAddress(IpAddressInfo address) { + if (_cachedIpAddress != null && _cachedIpAddress.Equals(address)) + { + // no need to update the file if the address has not changed + return; + } + var path = CacheFilePath; try @@ -164,6 +171,7 @@ namespace Emby.Server.Implementations.Connect try { _fileSystem.WriteAllText(path, _encryption.EncryptString(address.ToString()), Encoding.UTF8); + _cachedIpAddress = address; } catch (Exception ex) { @@ -184,6 +192,7 @@ namespace Emby.Server.Implementations.Connect if (_networkManager.TryParseIpAddress(endpoint, out ipAddress)) { + _cachedIpAddress = ipAddress; ((ConnectManager)_connectManager).OnWanAddressResolved(ipAddress); } } |
