aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/EntryPoints
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-11-07 10:50:55 +0100
committerBond-009 <bond.009@outlook.com>2019-11-07 10:50:55 +0100
commit983d38a43bd617de11724196f35822f07860a2eb (patch)
tree0eb15c7d7a5a4c270f966b6c4a8aee60f4a1a60e /Emby.Server.Implementations/EntryPoints
parent81c135c5bb01fbfb62ce67dc091e3e9f1c6d2c10 (diff)
parent2779d9d3bc9a9fd731e118f57d4601de4a55d032 (diff)
Merge branch 'master' into installationmanager
Diffstat (limited to 'Emby.Server.Implementations/EntryPoints')
-rw-r--r--Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs17
1 files changed, 11 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index f26a705867..d55dc2f18b 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -27,6 +27,11 @@ namespace Emby.Server.Implementations.EntryPoints
private NatManager _natManager;
+ private readonly object _createdRulesLock = new object();
+ private List<string> _createdRules = new List<string>();
+ private readonly object _usnsHandledLock = new object();
+ private List<string> _usnsHandled = new List<string>();
+
public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient)
{
_logger = loggerFactory.CreateLogger("PortMapper");
@@ -127,12 +132,13 @@ namespace Emby.Server.Implementations.EntryPoints
return;
}
- lock (_usnsHandled)
+ lock (_usnsHandledLock)
{
if (_usnsHandled.Contains(identifier))
{
return;
}
+
_usnsHandled.Add(identifier);
}
@@ -186,11 +192,12 @@ namespace Emby.Server.Implementations.EntryPoints
private void ClearCreatedRules(object state)
{
- lock (_createdRules)
+ lock (_createdRulesLock)
{
_createdRules.Clear();
}
- lock (_usnsHandled)
+
+ lock (_usnsHandledLock)
{
_usnsHandled.Clear();
}
@@ -216,8 +223,6 @@ namespace Emby.Server.Implementations.EntryPoints
}
}
- private List<string> _createdRules = new List<string>();
- private List<string> _usnsHandled = new List<string>();
private async void CreateRules(INatDevice device)
{
if (_disposed)
@@ -231,7 +236,7 @@ namespace Emby.Server.Implementations.EntryPoints
var addressString = address.ToString();
- lock (_createdRules)
+ lock (_createdRulesLock)
{
if (!_createdRules.Contains(addressString))
{