From 72b7cafe4f045cfa7812ceb60f8834dde930e052 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 27 Jun 2015 17:39:19 +0900 Subject: [PATCH] Refactored a few for WebSocketServer.cs --- websocket-sharp/Server/WebSocketServer.cs | 98 +++++++++++------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs index f7416358..20358ae2 100644 --- a/websocket-sharp/Server/WebSocketServer.cs +++ b/websocket-sharp/Server/WebSocketServer.cs @@ -62,7 +62,7 @@ namespace WebSocketSharp.Server private System.Net.IPAddress _address; private AuthenticationSchemes _authSchemes; - private Func _credentialsFinder; + private Func _credFinder; private TcpListener _listener; private Logger _logger; private int _port; @@ -234,8 +234,8 @@ namespace WebSocketSharp.Server /// /// Initializes a new instance of the class with - /// the specified , , and - /// . + /// the specified , , + /// and . /// /// /// An instance initialized by this constructor listens for the incoming @@ -352,8 +352,8 @@ namespace WebSocketSharp.Server } /// - /// Gets or sets a value indicating whether the server cleans up the inactive sessions - /// periodically. + /// Gets or sets a value indicating whether the server cleans up + /// the inactive sessions periodically. /// /// /// true if the server cleans up the inactive sessions every 60 seconds; @@ -408,8 +408,8 @@ namespace WebSocketSharp.Server /// Gets or sets the name of the realm associated with the server. /// /// - /// A that represents the name of the realm. - /// The default value is "SECRET AREA". + /// A that represents the name of the realm. The default value is + /// "SECRET AREA". /// public string Realm { get { @@ -428,12 +428,12 @@ namespace WebSocketSharp.Server } /// - /// Gets or sets a value indicating whether the server is allowed to be bound to an address - /// that is already in use. + /// Gets or sets a value indicating whether the server is allowed to be bound to + /// an address that is already in use. /// /// - /// If you would like to resolve to wait for socket in TIME_WAIT state, you should set - /// this property to true. + /// If you would like to resolve to wait for socket in TIME_WAIT state, + /// you should set this property to true. /// /// /// true if the server is allowed to be bound to an address that is already in use; @@ -460,8 +460,8 @@ namespace WebSocketSharp.Server /// 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. /// public ServerSslConfiguration SslConfiguration { get { @@ -484,13 +484,13 @@ namespace WebSocketSharp.Server /// authenticate a client. /// /// - /// A Func<, > delegate that - /// references the method(s) used to find the credentials. The default value is a function - /// that only returns . + /// A Func<, > delegate that + /// references the method(s) used to find the credentials. The default value is a function that + /// only returns . /// public Func UserCredentialsFinder { get { - return _credentialsFinder ?? (_credentialsFinder = identity => null); + return _credFinder ?? (_credFinder = identity => null); } set { @@ -500,7 +500,7 @@ namespace WebSocketSharp.Server return; } - _credentialsFinder = value; + _credFinder = value; } } @@ -669,7 +669,7 @@ namespace WebSocketSharp.Server }); } catch (SocketException ex) { - _logger.Warn ("Receiving has been stopped.\nreason: " + ex.Message); + _logger.Warn ("Receiving has been stopped.\n reason: " + ex.Message); break; } catch (Exception ex) { @@ -719,27 +719,6 @@ namespace WebSocketSharp.Server #region Public Methods - /// - /// Adds a WebSocket service with the specified behavior and . - /// - /// - /// This method converts to URL-decoded string, - /// and removes '/' from tail end of . - /// - /// - /// A that represents the absolute path to the service to add. - /// - /// - /// The type of the behavior of the service to add. The TBehaviorWithNew must inherit - /// the class, and must have a public parameterless - /// constructor. - /// - public void AddWebSocketService (string path) - where TBehaviorWithNew : WebSocketBehavior, new () - { - AddWebSocketService (path, () => new TBehaviorWithNew ()); - } - /// /// Adds a WebSocket service with the specified behavior, , /// and . @@ -758,9 +737,9 @@ namespace WebSocketSharp.Server /// A that represents the absolute path to the service to add. /// /// - /// A Func<T> delegate that references the method used to initialize a new specified - /// typed instance (a new - /// instance). + /// A Func<T> delegate that references the method used to initialize + /// a new specified typed instance (a new + /// instance). /// /// /// The type of the behavior of the service to add. The TBehavior must inherit @@ -780,6 +759,27 @@ namespace WebSocketSharp.Server _services.Add (path, initializer); } + /// + /// Adds a WebSocket service with the specified behavior and . + /// + /// + /// This method converts to URL-decoded string, + /// and removes '/' from tail end of . + /// + /// + /// A that represents the absolute path to the service to add. + /// + /// + /// The type of the behavior of the service to add. The TBehaviorWithNew must inherit + /// the class, and must have a public parameterless + /// constructor. + /// + public void AddWebSocketService (string path) + where TBehaviorWithNew : WebSocketBehavior, new () + { + AddWebSocketService (path, () => new TBehaviorWithNew ()); + } + /// /// Removes the WebSocket service with the specified . /// @@ -845,8 +845,8 @@ namespace WebSocketSharp.Server } /// - /// Stops receiving the WebSocket connection requests with the specified - /// and . + /// Stops receiving the WebSocket connection requests with + /// the specified and . /// /// /// A that represents the status code indicating the reason for the stop. @@ -879,12 +879,12 @@ namespace WebSocketSharp.Server } /// - /// Stops receiving the WebSocket connection requests with the specified - /// and . + /// Stops receiving the WebSocket connection requests with + /// the specified and . /// /// - /// One of the enum values, represents the status code - /// indicating the reason for the stop. + /// One of the enum values, represents the status code indicating + /// the reason for the stop. /// /// /// A that represents the reason for the stop.