aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-10-24 01:20:09 -0400
committerGitHub <noreply@github.com>2017-10-24 01:20:09 -0400
commit0aac8045fb69ad1024859812a09e68070ea698f6 (patch)
tree6e8b55133b0eeee606df5049497b80a612843733 /SocketHttpListener
parent7924bb7c9add449f61d8695add6f2f3fcbc18a0a (diff)
parent6c5f3ce07e8b36299a4143dc609999d880e7bdfd (diff)
Merge pull request #2974 from MediaBrowser/beta
Beta
Diffstat (limited to 'SocketHttpListener')
-rw-r--r--SocketHttpListener/Net/EndPointListener.cs9
-rw-r--r--SocketHttpListener/Net/HttpConnection.cs8
2 files changed, 16 insertions, 1 deletions
diff --git a/SocketHttpListener/Net/EndPointListener.cs b/SocketHttpListener/Net/EndPointListener.cs
index 2b1479e42..48c0ae7cb 100644
--- a/SocketHttpListener/Net/EndPointListener.cs
+++ b/SocketHttpListener/Net/EndPointListener.cs
@@ -93,6 +93,15 @@ namespace SocketHttpListener.Net
}
}
+ try
+ {
+ sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
+ }
+ catch (SocketException)
+ {
+ // This is not supported on all operating systems (qnap)
+ }
+
sock.Bind(endpoint);
// This is the number TcpListener uses.
diff --git a/SocketHttpListener/Net/HttpConnection.cs b/SocketHttpListener/Net/HttpConnection.cs
index 4e8158964..05576ea1e 100644
--- a/SocketHttpListener/Net/HttpConnection.cs
+++ b/SocketHttpListener/Net/HttpConnection.cs
@@ -528,7 +528,13 @@ namespace SocketHttpListener.Net
finally
{
if (s != null)
- s.Close();
+ {
+ try
+ {
+ s.Close();
+ }
+ catch { }
+ }
}
Unbind();
RemoveConnection();