From 1a1b109508206aa9230bdef81b657ede94967c0e Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 30 Aug 2014 11:58:16 +0900 Subject: [PATCH] Refactored WebSocketServiceHost.cs --- .../Server/WebSocketServiceHost.cs | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/websocket-sharp/Server/WebSocketServiceHost.cs b/websocket-sharp/Server/WebSocketServiceHost.cs index 808475e7..d9152389 100644 --- a/websocket-sharp/Server/WebSocketServiceHost.cs +++ b/websocket-sharp/Server/WebSocketServiceHost.cs @@ -29,7 +29,7 @@ #region Contributors /* * Contributors: - * Juan Manuel Lallana + * - Juan Manuel Lallana */ #endregion @@ -40,8 +40,8 @@ using WebSocketSharp.Net.WebSockets; namespace WebSocketSharp.Server { /// - /// Exposes the methods and properties used for accessing the information in a WebSocket - /// service provided by the or . + /// Exposes the methods and properties used to access the information in a WebSocket service + /// provided by the or . /// /// /// The WebSocketServiceHost class is an abstract class. @@ -69,7 +69,9 @@ namespace WebSocketSharp.Server /// true if the WebSocket service cleans up the inactive sessions periodically; /// otherwise, false. /// - public abstract bool KeepClean { get; set; } + public abstract bool KeepClean { + get; set; + } /// /// Gets the path to the WebSocket service. @@ -77,7 +79,9 @@ namespace WebSocketSharp.Server /// /// A that represents the absolute path to the WebSocket service. /// - public abstract string Path { get; } + public abstract string Path { + get; + } /// /// Gets the access to the sessions in the WebSocket service. @@ -85,7 +89,9 @@ namespace WebSocketSharp.Server /// /// A that manages the sessions. /// - public abstract WebSocketSessionManager Sessions { get; } + public abstract WebSocketSessionManager Sessions { + get; + } /// /// Gets the type of the WebSocket service. @@ -93,7 +99,9 @@ namespace WebSocketSharp.Server /// /// A that represents the type of the WebSocket service. /// - public abstract Type Type { get; } + public abstract Type Type { + get; + } #endregion @@ -101,8 +109,7 @@ namespace WebSocketSharp.Server internal void StartSession (WebSocketContext context) { - var session = CreateSession (); - session.Start (context, Sessions); + CreateSession ().Start (context, Sessions); } #endregion @@ -125,7 +132,7 @@ namespace WebSocketSharp.Server { #region Private Fields - private Func _constructor; + private Func _initializer; private string _path; private WebSocketSessionManager _sessions; @@ -133,10 +140,10 @@ namespace WebSocketSharp.Server #region Internal Constructors - internal WebSocketServiceHost (string path, Func constructor, Logger logger) + internal WebSocketServiceHost (string path, Func initializer, Logger logger) { _path = HttpUtility.UrlDecode (path).TrimEndSlash (); - _constructor = constructor; + _initializer = initializer; _sessions = new WebSocketSessionManager (logger); } @@ -178,7 +185,7 @@ namespace WebSocketSharp.Server protected override WebSocketService CreateSession () { - return _constructor (); + return _initializer (); } #endregion