From eb13c2ff1c77b8905988f8765780afc8a4c256b5 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 31 Aug 2016 16:44:44 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Server/WebSocketServer.cs | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs index 85fdba26..4e95f9a2 100644 --- a/websocket-sharp/Server/WebSocketServer.cs +++ b/websocket-sharp/Server/WebSocketServer.cs @@ -558,6 +558,35 @@ namespace WebSocketSharp.Server _state = ServerState.Stop; } + private bool checkIfAvailable ( + bool ready, bool start, bool shutting, bool stop, out string message + ) + { + message = null; + + if (!ready && _state == ServerState.Ready) { + message = "This operation is not available in: ready"; + return false; + } + + if (!start && _state == ServerState.Start) { + message = "This operation is not available in: start"; + return false; + } + + if (!shutting && _state == ServerState.ShuttingDown) { + message = "This operation is not available in: shutting down"; + return false; + } + + if (!stop && _state == ServerState.Stop) { + message = "This operation is not available in: stop"; + return false; + } + + return true; + } + private string checkIfCertificateExists () { return _secure && (_sslConfig == null || _sslConfig.ServerCertificate == null)