[Modify] Rename it

This commit is contained in:
sta 2018-06-26 19:38:48 +09:00
parent 485baba535
commit 7c515d1886
3 changed files with 38 additions and 38 deletions

View File

@ -38,6 +38,19 @@ namespace WebSocketSharp.Server
{ {
#region Properties #region Properties
/// <summary>
/// Gets the current state of the WebSocket connection for the session.
/// </summary>
/// <value>
/// <para>
/// One of the <see cref="WebSocketState"/> enum values.
/// </para>
/// <para>
/// It indicates the current state of the connection.
/// </para>
/// </value>
WebSocketState ConnectionState { get; }
/// <summary> /// <summary>
/// Gets the information in the WebSocket handshake request. /// Gets the information in the WebSocket handshake request.
/// </summary> /// </summary>
@ -73,19 +86,6 @@ namespace WebSocketSharp.Server
/// </value> /// </value>
DateTime StartTime { get; } DateTime StartTime { get; }
/// <summary>
/// Gets the current state of the WebSocket connection for the session.
/// </summary>
/// <value>
/// <para>
/// One of the <see cref="WebSocketState"/> enum values.
/// </para>
/// <para>
/// It indicates the current state of the connection.
/// </para>
/// </value>
WebSocketState State { get; }
#endregion #endregion
} }
} }

View File

@ -112,6 +112,29 @@ namespace WebSocketSharp.Server
#region Public Properties #region Public Properties
/// <summary>
/// Gets the current state of the WebSocket connection for a session.
/// </summary>
/// <value>
/// <para>
/// One of the <see cref="WebSocketState"/> enum values.
/// </para>
/// <para>
/// It indicates the current state of the connection.
/// </para>
/// <para>
/// <see cref="WebSocketState.Connecting"/> if the session has not
/// started yet.
/// </para>
/// </value>
public WebSocketState ConnectionState {
get {
return _websocket != null
? _websocket.ReadyState
: WebSocketState.Connecting;
}
}
/// <summary> /// <summary>
/// Gets the information in a handshake request to the WebSocket service. /// Gets the information in a handshake request to the WebSocket service.
/// </summary> /// </summary>
@ -299,7 +322,7 @@ namespace WebSocketSharp.Server
} }
set { set {
if (State != WebSocketState.Connecting) { if (ConnectionState != WebSocketState.Connecting) {
var msg = "The session has already started."; var msg = "The session has already started.";
throw new InvalidOperationException (msg); throw new InvalidOperationException (msg);
} }
@ -334,29 +357,6 @@ namespace WebSocketSharp.Server
} }
} }
/// <summary>
/// Gets the current state of the WebSocket connection for a session.
/// </summary>
/// <value>
/// <para>
/// One of the <see cref="WebSocketState"/> enum values.
/// </para>
/// <para>
/// It indicates the current state of the connection.
/// </para>
/// <para>
/// <see cref="WebSocketState.Connecting"/> if the session has not
/// started yet.
/// </para>
/// </value>
public WebSocketState State {
get {
return _websocket != null
? _websocket.ReadyState
: WebSocketState.Connecting;
}
}
#endregion #endregion
#region Private Methods #region Private Methods

View File

@ -1639,7 +1639,7 @@ namespace WebSocketSharp.Server
IWebSocketSession session; IWebSocketSession session;
if (_sessions.TryGetValue (id, out session)) { if (_sessions.TryGetValue (id, out session)) {
var state = session.State; var state = session.ConnectionState;
if (state == WebSocketState.Open) if (state == WebSocketState.Open)
session.Context.WebSocket.Close (CloseStatusCode.Abnormal); session.Context.WebSocket.Close (CloseStatusCode.Abnormal);
else if (state == WebSocketState.Closing) else if (state == WebSocketState.Closing)