[Modify] Throw exception
This commit is contained in:
parent
bb710e7743
commit
e7bab7a9a9
@ -334,19 +334,29 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
set {
|
set {
|
||||||
string msg;
|
if (!_client) {
|
||||||
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
|
var msg = "The set operation cannot be used by servers.";
|
||||||
_logger.Error (msg);
|
throw new InvalidOperationException (msg);
|
||||||
error ("An error has occurred in setting the compression.", null);
|
}
|
||||||
|
|
||||||
|
if (_readyState == WebSocketState.Open) {
|
||||||
|
_logger.Warn ("The connection has already been established.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_readyState == WebSocketState.Closing) {
|
||||||
|
_logger.Warn ("The connection is closing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (_forState) {
|
lock (_forState) {
|
||||||
if (!checkIfAvailable (true, false, false, true, out msg)) {
|
if (_readyState == WebSocketState.Open) {
|
||||||
_logger.Error (msg);
|
_logger.Warn ("The connection has already been established.");
|
||||||
error ("An error has occurred in setting the compression.", null);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_readyState == WebSocketState.Closing) {
|
||||||
|
_logger.Warn ("The connection is closing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user