diff --git a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs index 89cde3ff8..24e816aef 100644 --- a/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs +++ b/MediaBrowser.Common.Implementations/Archiving/ZipClient.cs @@ -6,8 +6,6 @@ using SharpCompress.Common; using SharpCompress.Reader; using SharpCompress.Reader.Zip; using System.IO; -using MediaBrowser.Common.IO; -using MediaBrowser.Model.IO; namespace MediaBrowser.Common.Implementations.Archiving { @@ -16,7 +14,7 @@ namespace MediaBrowser.Common.Implementations.Archiving /// public class ZipClient : IZipClient { - private IFileSystem _fileSystem; + private readonly IFileSystem _fileSystem; public ZipClient(IFileSystem fileSystem) { diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index 3d860a27b..9db49f97a 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -91,9 +91,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints NatUtility.DeviceLost += NatUtility_DeviceLost; - // it is hard to say what one should do when an unhandled exception is raised - // because there isn't anything one can do about it. Probably save a log or ignored it. - NatUtility.UnhandledException += NatUtility_UnhandledException; NatUtility.StartDiscovery(); _timer = new PeriodicTimer(ClearCreatedRules, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); @@ -184,21 +181,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints } } - void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - var ex = e.ExceptionObject as Exception; - - if (ex == null) - { - //_logger.Error("Unidentified error reported by Mono.Nat"); - } - else - { - // Seeing some blank exceptions coming through here - //_logger.ErrorException("Error reported by Mono.Nat: ", ex); - } - } - void NatUtility_DeviceFound(object sender, DeviceEventArgs e) { try @@ -287,7 +269,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints NatUtility.StopDiscovery(); NatUtility.DeviceFound -= NatUtility_DeviceFound; NatUtility.DeviceLost -= NatUtility_DeviceLost; - NatUtility.UnhandledException -= NatUtility_UnhandledException; } // Statements in try-block will no fail because StopDiscovery is a one-line // method that was no chances to fail. diff --git a/Mono.Nat/AbstractNatDevice.cs b/Mono.Nat/AbstractNatDevice.cs index e998a6ea4..1b4216002 100644 --- a/Mono.Nat/AbstractNatDevice.cs +++ b/Mono.Nat/AbstractNatDevice.cs @@ -52,43 +52,5 @@ namespace Mono.Nat } public abstract Task CreatePortMap(Mapping mapping); - - public virtual void DeletePortMap (Mapping mapping) - { - IAsyncResult result = BeginDeletePortMap (mapping, null, mapping); - EndDeletePortMap(result); - } - - public virtual Mapping[] GetAllMappings () - { - IAsyncResult result = BeginGetAllMappings (null, null); - return EndGetAllMappings (result); - } - - public virtual IPAddress GetExternalIP () - { - IAsyncResult result = BeginGetExternalIP(null, null); - return EndGetExternalIP(result); - } - - public virtual Mapping GetSpecificMapping (Protocol protocol, int port) - { - IAsyncResult result = this.BeginGetSpecificMapping (protocol, port, null, null); - return this.EndGetSpecificMapping(result); - } - - public abstract IAsyncResult BeginCreatePortMap(Mapping mapping, AsyncCallback callback, object asyncState); - public abstract IAsyncResult BeginDeletePortMap (Mapping mapping, AsyncCallback callback, object asyncState); - - public abstract IAsyncResult BeginGetAllMappings (AsyncCallback callback, object asyncState); - public abstract IAsyncResult BeginGetExternalIP (AsyncCallback callback, object asyncState); - public abstract IAsyncResult BeginGetSpecificMapping(Protocol protocol, int externalPort, AsyncCallback callback, object asyncState); - - public abstract void EndCreatePortMap (IAsyncResult result); - public abstract void EndDeletePortMap (IAsyncResult result); - - public abstract Mapping[] EndGetAllMappings (IAsyncResult result); - public abstract IPAddress EndGetExternalIP (IAsyncResult result); - public abstract Mapping EndGetSpecificMapping (IAsyncResult result); } } diff --git a/Mono.Nat/INatDevice.cs b/Mono.Nat/INatDevice.cs index 44ba5223b..b0401627b 100644 --- a/Mono.Nat/INatDevice.cs +++ b/Mono.Nat/INatDevice.cs @@ -37,26 +37,8 @@ namespace Mono.Nat public interface INatDevice { Task CreatePortMap (Mapping mapping); - void DeletePortMap (Mapping mapping); IPAddress LocalAddress { get; } - Mapping[] GetAllMappings (); - IPAddress GetExternalIP (); - Mapping GetSpecificMapping (Protocol protocol, int port); - - IAsyncResult BeginCreatePortMap (Mapping mapping, AsyncCallback callback, object asyncState); - IAsyncResult BeginDeletePortMap (Mapping mapping, AsyncCallback callback, object asyncState); - - IAsyncResult BeginGetAllMappings (AsyncCallback callback, object asyncState); - IAsyncResult BeginGetExternalIP (AsyncCallback callback, object asyncState); - IAsyncResult BeginGetSpecificMapping (Protocol protocol, int externalPort, AsyncCallback callback, object asyncState); - - void EndCreatePortMap (IAsyncResult result); - void EndDeletePortMap (IAsyncResult result); - - Mapping[] EndGetAllMappings (IAsyncResult result); - IPAddress EndGetExternalIP (IAsyncResult result); - Mapping EndGetSpecificMapping (IAsyncResult result); DateTime LastSeen { get; set; } } diff --git a/Mono.Nat/Mono.Nat.csproj b/Mono.Nat/Mono.Nat.csproj index c9d79bbdf..273bdb20c 100644 --- a/Mono.Nat/Mono.Nat.csproj +++ b/Mono.Nat/Mono.Nat.csproj @@ -56,20 +56,11 @@ - - - - - - - - - @@ -89,6 +80,9 @@ MediaBrowser.Model + + +