diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-19 15:11:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-19 15:11:50 -0500 |
| commit | 55538764fa06a64795c099fc6496df9dbb4156bd (patch) | |
| tree | 8c1f94861ecebdf634b70a7265945b6f8f13aff1 /SocketHttpListener/Net/HttpEndPointListener.cs | |
| parent | 3b52035ee064a5d9aa215d9515211d4508585d39 (diff) | |
| parent | c5430f86b0b5863482e7c4f7e55a79c7d88c133b (diff) | |
Merge pull request #575 from EraYaN/reformat
Reformat all C# server code to conform with code standards
Diffstat (limited to 'SocketHttpListener/Net/HttpEndPointListener.cs')
| -rw-r--r-- | SocketHttpListener/Net/HttpEndPointListener.cs | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/SocketHttpListener/Net/HttpEndPointListener.cs b/SocketHttpListener/Net/HttpEndPointListener.cs index a108e7dd4..ea7d8fd2d 100644 --- a/SocketHttpListener/Net/HttpEndPointListener.cs +++ b/SocketHttpListener/Net/HttpEndPointListener.cs @@ -1,21 +1,15 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.IO; using System.Net; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; using System.Threading; using MediaBrowser.Model.Cryptography; using MediaBrowser.Model.IO; -using Microsoft.Extensions.Logging; using MediaBrowser.Model.Net; using MediaBrowser.Model.System; using MediaBrowser.Model.Text; -using SocketHttpListener.Primitives; -using ProtocolType = MediaBrowser.Model.Net.ProtocolType; -using SocketType = MediaBrowser.Model.Net.SocketType; -using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace SocketHttpListener.Net { @@ -64,13 +58,7 @@ namespace SocketHttpListener.Net CreateSocket(); } - internal HttpListener Listener - { - get - { - return _listener; - } - } + internal HttpListener Listener => _listener; private void CreateSocket() { @@ -172,7 +160,7 @@ namespace SocketHttpListener.Net } catch (Exception ex) { - HttpEndPointListener epl = (HttpEndPointListener)acceptEventArg.UserToken; + var epl = (HttpEndPointListener)acceptEventArg.UserToken; epl._logger.LogError(ex, "Error in socket.AcceptAsync"); } @@ -188,7 +176,7 @@ namespace SocketHttpListener.Net private static async void ProcessAccept(SocketAsyncEventArgs args) { - HttpEndPointListener epl = (HttpEndPointListener)args.UserToken; + var epl = (HttpEndPointListener)args.UserToken; if (epl._closed) { @@ -209,7 +197,7 @@ namespace SocketHttpListener.Net return; } - if(accepted == null) + if (accepted == null) { return; } @@ -226,7 +214,7 @@ namespace SocketHttpListener.Net var localEndPointString = accepted.LocalEndPoint == null ? string.Empty : accepted.LocalEndPoint.ToString(); //_logger.LogInformation("HttpEndPointListener Accepting connection from {0} to {1} secure connection requested: {2}", remoteEndPointString, localEndPointString, _secure); - HttpConnection conn = new HttpConnection(epl._logger, accepted, epl, epl._secure, epl._cert, epl._cryptoProvider, epl._streamHelper, epl._textEncoding, epl._fileSystem, epl._environment); + var conn = new HttpConnection(epl._logger, accepted, epl, epl._secure, epl._cert, epl._cryptoProvider, epl._streamHelper, epl._textEncoding, epl._fileSystem, epl._environment); await conn.Init().ConfigureAwait(false); @@ -288,9 +276,8 @@ namespace SocketHttpListener.Net public bool BindContext(HttpListenerContext context) { - HttpListenerRequest req = context.Request; - ListenerPrefix prefix; - HttpListener listener = SearchListener(req.Url, out prefix); + var req = context.Request; + HttpListener listener = SearchListener(req.Url, out var prefix); if (listener == null) return false; @@ -323,7 +310,7 @@ namespace SocketHttpListener.Net if (host != null && host != "") { Dictionary<ListenerPrefix, HttpListener> localPrefixes = _prefixes; - foreach (ListenerPrefix p in localPrefixes.Keys) + foreach (var p in localPrefixes.Keys) { string ppath = p.Path; if (ppath.Length < bestLength) |
