From ff069636135541b7f8b082db53114ebaf2712870 Mon Sep 17 00:00:00 2001 From: sta Date: Fri, 15 May 2015 17:47:32 +0900 Subject: [PATCH] Refactored a few for HttpListener.cs --- websocket-sharp/Net/HttpListener.cs | 30 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/websocket-sharp/Net/HttpListener.cs b/websocket-sharp/Net/HttpListener.cs index 75924a42..830fcd30 100644 --- a/websocket-sharp/Net/HttpListener.cs +++ b/websocket-sharp/Net/HttpListener.cs @@ -315,9 +315,7 @@ namespace WebSocketSharp.Net public string Realm { get { CheckDisposed (); - return _realm != null && _realm.Length > 0 - ? _realm - : (_realm = "SECRET AREA"); + return _realm != null && _realm.Length > 0 ? _realm : (_realm = "SECRET AREA"); } set { @@ -331,8 +329,8 @@ namespace WebSocketSharp.Net /// optionally the client for secure connection. /// /// - /// A that represents the configuration used - /// to authenticate the server and optionally the client for secure connection. + /// A that represents the configuration used to + /// authenticate the server and optionally the client for secure connection. /// /// /// This listener has been closed. @@ -380,9 +378,9 @@ namespace WebSocketSharp.Net /// authenticate a client. /// /// - /// A Func<, > delegate - /// that references the method used to find the credentials. The default value is a function - /// that only returns . + /// A Func<, > delegate that + /// references the method used to find the credentials. The default value is a function that + /// only returns . /// /// /// This listener has been closed. @@ -421,7 +419,7 @@ namespace WebSocketSharp.Net if (_connections.Count == 0) return; - // Need to copy this since closing will call RemoveConnection. + // Need to copy this since closing will call the RemoveConnection method. var keys = _connections.Keys; var conns = new HttpConnection[keys.Count]; keys.CopyTo (conns, 0); @@ -437,7 +435,7 @@ namespace WebSocketSharp.Net if (_ctxRegistry.Count == 0) return; - // Need to copy this since closing will call UnregisterContext. + // Need to copy this since closing will call the UnregisterContext method. var keys = _ctxRegistry.Keys; var ctxs = new HttpListenerContext[keys.Count]; keys.CopyTo (ctxs, 0); @@ -608,9 +606,9 @@ namespace WebSocketSharp.Net _ctxRegistry.Remove (context); lock (_ctxQueueSync) { - var i = _ctxQueue.IndexOf (context); - if (i >= 0) - _ctxQueue.RemoveAt (i); + var idx = _ctxQueue.IndexOf (context); + if (idx >= 0) + _ctxQueue.RemoveAt (idx); } } @@ -641,8 +639,8 @@ namespace WebSocketSharp.Net /// An that represents the status of the asynchronous operation. /// /// - /// An delegate that references the method to invoke - /// when the asynchronous operation completes. + /// An delegate that references the method to invoke when + /// the asynchronous operation completes. /// /// /// An that represents a user defined object to pass to @@ -721,7 +719,7 @@ namespace WebSocketSharp.Net if (!ares.IsCompleted) ares.AsyncWaitHandle.WaitOne (); - return ares.GetContext (); // This will throw on error. + return ares.GetContext (); // This may throw an exception. } ///