aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/EntryPoints
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-14 12:22:04 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-14 12:22:04 -0400
commit360e666cc630c2200111a68f027c0ef6a176f73a (patch)
treeb3f904fe54e60ca58e5a3eb0925774665aaa3201 /MediaBrowser.Server.Implementations/EntryPoints
parente206725b734f9a6226faa78ff2d0ecd2f551acc1 (diff)
update recording dialogs
Diffstat (limited to 'MediaBrowser.Server.Implementations/EntryPoints')
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs52
1 files changed, 32 insertions, 20 deletions
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 1021d8823..3274231ee 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -122,43 +122,55 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
var identifier = string.IsNullOrWhiteSpace(usn) ? nt : usn;
- if (info.Location != null && !_usnsHandled.Contains(identifier))
+ if (info.Location == null)
{
+ return;
+ }
+
+ lock (_usnsHandled)
+ {
+ if (_usnsHandled.Contains(identifier))
+ {
+ return;
+ }
_usnsHandled.Add(identifier);
+ }
- _logger.Debug("Calling Nat.Handle on " + identifier);
+ _logger.Debug("Calling Nat.Handle on " + identifier);
- IPAddress address;
- if (IPAddress.TryParse(info.Location.Host, out address))
- {
- // The Handle method doesn't need the port
- var endpoint = new IPEndPoint(address, info.Location.Port);
+ IPAddress address;
+ if (IPAddress.TryParse(info.Location.Host, out address))
+ {
+ // The Handle method doesn't need the port
+ var endpoint = new IPEndPoint(address, info.Location.Port);
- IPAddress localAddress = null;
+ IPAddress localAddress = null;
- try
- {
- var localAddressString = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
+ try
+ {
+ var localAddressString = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
- if (!IPAddress.TryParse(localAddressString, out localAddress))
- {
- return;
- }
- }
- catch
+ if (!IPAddress.TryParse(localAddressString, out localAddress))
{
return;
}
-
- NatUtility.Handle(localAddress, info, endpoint, NatProtocol.Upnp);
}
+ catch
+ {
+ return;
+ }
+
+ NatUtility.Handle(localAddress, info, endpoint, NatProtocol.Upnp);
}
}
private void ClearCreatedRules(object state)
{
_createdRules = new List<string>();
- _usnsHandled = new List<string>();
+ lock (_usnsHandled)
+ {
+ _usnsHandled.Clear();
+ }
}
void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e)