Skip to content

Commit efec202

Browse files
committed
[Modify] Throw exception
1 parent 3ef00d0 commit efec202

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

websocket-sharp/WebSocket.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,27 @@ public TimeSpan WaitTime {
608608
}
609609

610610
set {
611+
if (value <= TimeSpan.Zero)
612+
throw new ArgumentOutOfRangeException ("value", "Zero or less.");
613+
614+
if (_readyState == WebSocketState.Open) {
615+
_logger.Warn ("The connection has already been established.");
616+
return;
617+
}
618+
619+
if (_readyState == WebSocketState.Closing) {
620+
_logger.Warn ("The connection is closing.");
621+
return;
622+
}
623+
611624
lock (_forState) {
612-
string msg;
613-
if (!checkIfAvailable (true, true, true, false, false, true, out msg)
614-
|| !value.CheckWaitTime (out msg)
615-
) {
616-
_logger.Error (msg);
617-
error ("An error has occurred in setting the wait time.", null);
625+
if (_readyState == WebSocketState.Open) {
626+
_logger.Warn ("The connection has already been established.");
627+
return;
628+
}
618629

630+
if (_readyState == WebSocketState.Closing) {
631+
_logger.Warn ("The connection is closing.");
619632
return;
620633
}
621634

0 commit comments

Comments
 (0)