The Free Software Media System - Server Backend & API
Properly remove event handler
Bond_009210af0e73e63
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.csindex 7cf850932f..08041eb59f 100644--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs@@ -65,23 +65,20 @@ namespace Emby.Server.Implementations.EntryPoints.ToString();}- private async void OnConfigurationUpdated(object sender, EventArgs e)+ private void OnConfigurationUpdated(object sender, EventArgs e){if (!string.Equals(_lastConfigIdentifier, GetConfigIdentifier(), StringComparison.OrdinalIgnoreCase)){Stop();- await RunAsync().ConfigureAwait(false);+ Start();}}/// <inheritdoc />public Task RunAsync(){- if (_config.Configuration.EnableUPnP && _config.Configuration.EnableRemoteAccess)- {- Start();- }+ Start();_config.ConfigurationUpdated += OnConfigurationUpdated;@@ -90,6 +87,11 @@ namespace Emby.Server.Implementations.EntryPointsprivate void Start(){+ if (!_config.Configuration.EnableUPnP || !_config.Configuration.EnableRemoteAccess)+ {+ return;+ }+_logger.LogDebug("Starting NAT discovery");NatUtility.DeviceFound += OnNatUtilityDeviceFound;@@ -214,6 +216,8 @@ namespace Emby.Server.Implementations.EntryPointsreturn;}+ _config.ConfigurationUpdated -= OnConfigurationUpdated;+Stop();_timer = null;