[Modify] Polish it

This commit is contained in:
sta 2021-11-23 21:21:58 +09:00
parent 65f34f5307
commit 898d399c46

View File

@ -1543,12 +1543,14 @@ namespace WebSocketSharp.Server
{ {
if (_sweeping) { if (_sweeping) {
_log.Info ("The sweeping is already in progress."); _log.Info ("The sweeping is already in progress.");
return; return;
} }
lock (_forSweep) { lock (_forSweep) {
if (_sweeping) { if (_sweeping) {
_log.Info ("The sweeping is already in progress."); _log.Info ("The sweeping is already in progress.");
return; return;
} }
@ -1564,8 +1566,10 @@ namespace WebSocketSharp.Server
break; break;
IWebSocketSession session; IWebSocketSession session;
if (_sessions.TryGetValue (id, out session)) { if (_sessions.TryGetValue (id, out session)) {
var state = session.ConnectionState; 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)