[Modify] Throw exception
This commit is contained in:
parent
bf53fa97d7
commit
9bce5b03f2
@ -1219,6 +1219,13 @@ namespace WebSocketSharp
|
|||||||
// As client
|
// As client
|
||||||
private bool connect ()
|
private bool connect ()
|
||||||
{
|
{
|
||||||
|
if (_readyState == WebSocketState.Open) {
|
||||||
|
var msg = "The connection has already been established.";
|
||||||
|
_logger.Warn (msg);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
lock (_forState) {
|
lock (_forState) {
|
||||||
if (_readyState == WebSocketState.Open) {
|
if (_readyState == WebSocketState.Open) {
|
||||||
var msg = "The connection has already been established.";
|
var msg = "The connection has already been established.";
|
||||||
@ -1228,8 +1235,11 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Closing) {
|
if (_readyState == WebSocketState.Closing) {
|
||||||
var msg = "The close process is in progress.";
|
var msg = "The close process has set in.";
|
||||||
_logger.Warn (msg);
|
_logger.Error (msg);
|
||||||
|
|
||||||
|
msg = "An interruption has occurred while attempting to connect.";
|
||||||
|
error (msg, null);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3127,18 +3137,9 @@ namespace WebSocketSharp
|
|||||||
throw new InvalidOperationException (msg);
|
throw new InvalidOperationException (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Open) {
|
|
||||||
var msg = "The connection has already been established.";
|
|
||||||
_logger.Warn (msg);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Closing) {
|
if (_readyState == WebSocketState.Closing) {
|
||||||
var msg = "The close process is in progress.";
|
var msg = "The close process is in progress.";
|
||||||
_logger.Warn (msg);
|
throw new InvalidOperationException (msg);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect ())
|
if (connect ())
|
||||||
@ -3167,18 +3168,9 @@ namespace WebSocketSharp
|
|||||||
throw new InvalidOperationException (msg);
|
throw new InvalidOperationException (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Open) {
|
|
||||||
var msg = "The connection has already been established.";
|
|
||||||
_logger.Warn (msg);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Closing) {
|
if (_readyState == WebSocketState.Closing) {
|
||||||
var msg = "The close process is in progress.";
|
var msg = "The close process is in progress.";
|
||||||
_logger.Warn (msg);
|
throw new InvalidOperationException (msg);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Func<bool> connector = connect;
|
Func<bool> connector = connect;
|
||||||
|
Loading…
Reference in New Issue
Block a user