Added the internal Ext.CheckIfCanStop (ServerState) method
This commit is contained in:
parent
46eae139e2
commit
80a0107bab
@ -245,6 +245,13 @@ namespace WebSocketSharp
|
||||
: null;
|
||||
}
|
||||
|
||||
internal static string CheckIfCanStop (this ServerState state)
|
||||
{
|
||||
return state != ServerState.Start
|
||||
? String.Format ("This operation isn't available ({0}).", state)
|
||||
: null;
|
||||
}
|
||||
|
||||
internal static string CheckIfStart (this ServerState state)
|
||||
{
|
||||
return state == ServerState.Ready
|
||||
|
@ -911,7 +911,7 @@ namespace WebSocketSharp.Server
|
||||
public void Stop ()
|
||||
{
|
||||
lock (_sync) {
|
||||
var msg = _state.CheckIfStart ();
|
||||
var msg = _state.CheckIfCanStop ();
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
return;
|
||||
@ -939,7 +939,7 @@ namespace WebSocketSharp.Server
|
||||
public void Stop (ushort code, string reason)
|
||||
{
|
||||
lock (_sync) {
|
||||
var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
var msg = _state.CheckIfCanStop () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
return;
|
||||
@ -975,7 +975,7 @@ namespace WebSocketSharp.Server
|
||||
public void Stop (CloseStatusCode code, string reason)
|
||||
{
|
||||
lock (_sync) {
|
||||
var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
var msg = _state.CheckIfCanStop () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
return;
|
||||
|
@ -814,7 +814,7 @@ namespace WebSocketSharp.Server
|
||||
public void Stop ()
|
||||
{
|
||||
lock (_sync) {
|
||||
var msg = _state.CheckIfStart ();
|
||||
var msg = _state.CheckIfCanStop ();
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
return;
|
||||
@ -842,7 +842,7 @@ namespace WebSocketSharp.Server
|
||||
public void Stop (ushort code, string reason)
|
||||
{
|
||||
lock (_sync) {
|
||||
var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
var msg = _state.CheckIfCanStop () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
return;
|
||||
@ -877,7 +877,7 @@ namespace WebSocketSharp.Server
|
||||
public void Stop (CloseStatusCode code, string reason)
|
||||
{
|
||||
lock (_sync) {
|
||||
var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
var msg = _state.CheckIfCanStop () ?? WebSocket.CheckCloseParameters (code, reason, false);
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user