From 48764612096b86b2c66c1e425692b93972c3d56b Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 18 Apr 2015 17:42:28 +0900 Subject: [PATCH] Refactored a few for WebSocketBehavior.cs --- websocket-sharp/Server/WebSocketBehavior.cs | 77 ++++++++++----------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/websocket-sharp/Server/WebSocketBehavior.cs b/websocket-sharp/Server/WebSocketBehavior.cs index 33519aa2..b1c5a173 100644 --- a/websocket-sharp/Server/WebSocketBehavior.cs +++ b/websocket-sharp/Server/WebSocketBehavior.cs @@ -51,7 +51,7 @@ namespace WebSocketSharp.Server private Func _originValidator; private string _protocol; private WebSocketSessionManager _sessions; - private DateTime _start; + private DateTime _startTime; private WebSocket _websocket; #endregion @@ -63,7 +63,7 @@ namespace WebSocketSharp.Server /// protected WebSocketBehavior () { - _start = DateTime.MaxValue; + _startTime = DateTime.MaxValue; } #endregion @@ -79,9 +79,7 @@ namespace WebSocketSharp.Server /// protected Logger Log { get { - return _websocket != null - ? _websocket.Log - : null; + return _websocket != null ? _websocket.Log : null; } } @@ -103,10 +101,10 @@ namespace WebSocketSharp.Server #region Public Properties /// - /// Gets the information in the current connection request to the WebSocket service. + /// Gets the information in a connection request to the WebSocket service. /// /// - /// A that provides the access to the current connection request, + /// A that provides the access to the connection request, /// or if the WebSocket connection isn't established. /// public WebSocketContext Context { @@ -116,12 +114,12 @@ namespace WebSocketSharp.Server } /// - /// Gets or sets the delegate called to validate the HTTP cookies included in a connection - /// request to the WebSocket service. + /// Gets or sets the delegate called to validate the HTTP cookies included in + /// a connection request to the WebSocket service. /// /// - /// The delegate is called when the used in the current session - /// validates the connection request. + /// The delegate is called when the used in the session validates + /// the connection request. /// /// /// @@ -148,10 +146,10 @@ namespace WebSocketSharp.Server } /// - /// Gets the unique ID of the current session. + /// Gets the unique ID of a session. /// /// - /// A that represents the unique ID of the current session, + /// A that represents the unique ID of the session, /// or if the WebSocket connection isn't established. /// public string ID { @@ -179,12 +177,12 @@ namespace WebSocketSharp.Server } /// - /// Gets or sets the delegate called to validate the Origin header included in a connection - /// request to the WebSocket service. + /// Gets or sets the delegate called to validate the Origin header included in + /// a connection request to the WebSocket service. /// /// - /// The delegate is called when the used in the current session - /// validates the connection request. + /// The delegate is called when the used in the session validates + /// the connection request. /// /// /// @@ -210,7 +208,7 @@ namespace WebSocketSharp.Server } /// - /// Gets or sets the WebSocket subprotocol used in the current session. + /// Gets or sets the WebSocket subprotocol used in the WebSocket service. /// /// /// Set operation of this property is available before the WebSocket connection has been @@ -228,9 +226,7 @@ namespace WebSocketSharp.Server /// public string Protocol { get { - return _websocket != null - ? _websocket.Protocol - : _protocol ?? String.Empty; + return _websocket != null ? _websocket.Protocol : (_protocol ?? String.Empty); } set { @@ -245,30 +241,28 @@ namespace WebSocketSharp.Server } /// - /// Gets the time that the current session has started. + /// Gets the time that a session has started. /// /// - /// A that represents the time that the current session has started, + /// A that represents the time that the session has started, /// or if the WebSocket connection isn't established. /// public DateTime StartTime { get { - return _start; + return _startTime; } } /// - /// Gets the state of the used in the current session. + /// Gets the state of the used in a session. /// /// /// One of the enum values, indicates the state of - /// the used in the current session. + /// the used in the session. /// public WebSocketState State { get { - return _websocket != null - ? _websocket.ReadyState - : WebSocketState.Connecting; + return _websocket != null ? _websocket.ReadyState : WebSocketState.Connecting; } } @@ -313,7 +307,7 @@ namespace WebSocketSharp.Server return; } - _start = DateTime.Now; + _startTime = DateTime.Now; OnOpen (); } @@ -375,7 +369,7 @@ namespace WebSocketSharp.Server } /// - /// Called when the WebSocket connection used in the current session has been closed. + /// Called when the WebSocket connection used in a session has been closed. /// /// /// A that represents the event data passed to @@ -386,7 +380,7 @@ namespace WebSocketSharp.Server } /// - /// Called when the used in the current session gets an error. + /// Called when the used in a session gets an error. /// /// /// A that represents the event data passed to @@ -397,7 +391,7 @@ namespace WebSocketSharp.Server } /// - /// Called when the used in the current session receives a message. + /// Called when the used in a session receives a message. /// /// /// A that represents the event data passed to @@ -408,14 +402,14 @@ namespace WebSocketSharp.Server } /// - /// Called when the WebSocket connection used in the current session has been established. + /// Called when the WebSocket connection used in a session has been established. /// protected virtual void OnOpen () { } /// - /// Sends a binary to the client on the current session. + /// Sends a binary to the client on a session. /// /// /// This method is available after the WebSocket connection has been established. @@ -430,8 +424,7 @@ namespace WebSocketSharp.Server } /// - /// Sends the specified as a binary data to the client - /// on the current session. + /// Sends the specified as a binary data to the client on a session. /// /// /// This method is available after the WebSocket connection has been established. @@ -446,7 +439,7 @@ namespace WebSocketSharp.Server } /// - /// Sends a text to the client on the current session. + /// Sends a text to the client on a session. /// /// /// This method is available after the WebSocket connection has been established. @@ -461,7 +454,7 @@ namespace WebSocketSharp.Server } /// - /// Sends a binary asynchronously to the client on the current session. + /// Sends a binary asynchronously to the client on a session. /// /// /// @@ -487,7 +480,7 @@ namespace WebSocketSharp.Server /// /// Sends the specified as a binary data asynchronously - /// to the client on the current session. + /// to the client on a session. /// /// /// @@ -512,7 +505,7 @@ namespace WebSocketSharp.Server } /// - /// Sends a text asynchronously to the client on the current session. + /// Sends a text asynchronously to the client on a session. /// /// /// @@ -538,7 +531,7 @@ namespace WebSocketSharp.Server /// /// Sends a binary data from the specified asynchronously - /// to the client on the current session. + /// to the client on a session. /// /// ///