The Free Software Media System - Server Backend & API
Do not update wan.dat if WAN IP has not changed
Ivan-Lb98ef8fac06c
diff --git a/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs b/Emby.Server.Implementations/Connect/ConnectEntryPoint.csindex 7f15f20cb8..b5639773b4 100644--- a/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs+++ b/Emby.Server.Implementations/Connect/ConnectEntryPoint.cs@@ -18,6 +18,7 @@ namespace Emby.Server.Implementations.Connectpublic 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.Connectprivate 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.Connecttry{_fileSystem.WriteAllText(path, _encryption.EncryptString(address.ToString()), Encoding.UTF8);+ _cachedIpAddress = address;}catch (Exception ex){@@ -184,6 +192,7 @@ namespace Emby.Server.Implementations.Connectif (_networkManager.TryParseIpAddress(endpoint, out ipAddress)){+ _cachedIpAddress = ipAddress;((ConnectManager)_connectManager).OnWanAddressResolved(ipAddress);}}