[Modify] Rename it
This commit is contained in:
parent
485baba535
commit
7c515d1886
@ -38,6 +38,19 @@ namespace WebSocketSharp.Server
|
||||
{
|
||||
#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>
|
||||
/// Gets the information in the WebSocket handshake request.
|
||||
/// </summary>
|
||||
@ -73,19 +86,6 @@ namespace WebSocketSharp.Server
|
||||
/// </value>
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,29 @@ namespace WebSocketSharp.Server
|
||||
|
||||
#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>
|
||||
/// Gets the information in a handshake request to the WebSocket service.
|
||||
/// </summary>
|
||||
@ -299,7 +322,7 @@ namespace WebSocketSharp.Server
|
||||
}
|
||||
|
||||
set {
|
||||
if (State != WebSocketState.Connecting) {
|
||||
if (ConnectionState != WebSocketState.Connecting) {
|
||||
var msg = "The session has already started.";
|
||||
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
|
||||
|
||||
#region Private Methods
|
||||
|
@ -1639,7 +1639,7 @@ namespace WebSocketSharp.Server
|
||||
|
||||
IWebSocketSession session;
|
||||
if (_sessions.TryGetValue (id, out session)) {
|
||||
var state = session.State;
|
||||
var state = session.ConnectionState;
|
||||
if (state == WebSocketState.Open)
|
||||
session.Context.WebSocket.Close (CloseStatusCode.Abnormal);
|
||||
else if (state == WebSocketState.Closing)
|
||||
|
Loading…
Reference in New Issue
Block a user