[Modify] Polish it

This commit is contained in:
sta 2021-10-29 19:35:08 +09:00
parent 78cc325f97
commit 457a60b6cd

View File

@ -349,16 +349,21 @@ namespace WebSocketSharp.Server
set {
if (ConnectionState != WebSocketState.Connecting) {
var msg = "The session has already started.";
throw new InvalidOperationException (msg);
}
if (value == null || value.Length == 0) {
_protocol = null;
return;
}
if (!value.IsToken ())
throw new ArgumentException ("Not a token.", "value");
if (!value.IsToken ()) {
var msg = "It is not a token.";
throw new ArgumentException (msg, "value");
}
_protocol = value;
}