aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/EntryPoints
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-04-19 11:54:20 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-04-19 11:54:20 -0400
commit37f22e67f97e5fdfcaf55fa0ee3d7e5bdab08e77 (patch)
treee4c4ba0d96c0ec69c1a18393495a2539b85edc9f /MediaBrowser.Server.Implementations/EntryPoints
parentb3df19b51596ccc464464ce2d191b264d0f5f204 (diff)
added a photo view
Diffstat (limited to 'MediaBrowser.Server.Implementations/EntryPoints')
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs48
1 files changed, 8 insertions, 40 deletions
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 966e0a3e4..3fa0df760 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -1,5 +1,4 @@
-using System.Linq;
-using MediaBrowser.Controller;
+using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
@@ -139,55 +138,24 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
// On some systems the device discovered event seems to fire repeatedly
// This check will help ensure we're not trying to port map the same device over and over
- List<Mapping> currentMappings = null;
-
- try
- {
- currentMappings = device.GetAllMappings().ToList();
- }
- catch (NotSupportedException)
- {
- }
-
var address = device.LocalAddress.ToString();
if (!_createdRules.Contains(address))
{
_createdRules.Add(address);
- CreatePortMap(device, currentMappings, _appHost.HttpPort, _config.Configuration.PublicPort);
- CreatePortMap(device, currentMappings, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort);
+ CreatePortMap(device, _appHost.HttpPort, _config.Configuration.PublicPort);
+ CreatePortMap(device, _appHost.HttpsPort, _config.Configuration.PublicHttpsPort);
}
}
- private void CreatePortMap(INatDevice device, List<Mapping> currentMappings, int privatePort, int publicPort)
+ private void CreatePortMap(INatDevice device, int privatePort, int publicPort)
{
- var hasMapping = false;
-
- if (currentMappings != null)
- {
- hasMapping = currentMappings.Any(i => i.PublicPort == publicPort && i.PrivatePort == privatePort);
- }
- else
+ _logger.Debug("Creating port map on port {0}", privatePort);
+ device.CreatePortMap(new Mapping(Protocol.Tcp, privatePort, publicPort)
{
- try
- {
- var mapping = device.GetSpecificMapping(Protocol.Tcp, publicPort);
- hasMapping = mapping != null;
- }
- catch (NotSupportedException)
- {
- }
- }
-
- if (!hasMapping)
- {
- _logger.Debug("Creating port map on port {0}", privatePort);
- device.CreatePortMap(new Mapping(Protocol.Tcp, privatePort, publicPort)
- {
- Description = _appHost.Name
- });
- }
+ Description = _appHost.Name
+ });
}
// As I said before, this method will be never invoked. You can remove it.