Skip to content

Commit ed12cca

Browse files
committed
[Modify] Rethrow it
1 parent 5dab752 commit ed12cca

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

websocket-sharp/Server/WebSocketServer.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,14 @@ private void stop (ushort code, string reason)
10261026

10271027
private void stopReceiving (int millisecondsTimeout)
10281028
{
1029-
_listener.Stop ();
1029+
try {
1030+
_listener.Stop ();
1031+
}
1032+
catch (Exception ex) {
1033+
var msg = "The underlying listener has failed to stop.";
1034+
throw new InvalidOperationException (msg, ex);
1035+
}
1036+
10301037
_receiveThread.Join (millisecondsTimeout);
10311038
}
10321039

@@ -1343,7 +1350,7 @@ public void Start ()
13431350
/// This method does nothing if the server is not started,
13441351
/// it is shutting down, or it has already stopped.
13451352
/// </remarks>
1346-
/// <exception cref="SocketException">
1353+
/// <exception cref="InvalidOperationException">
13471354
/// The underlying <see cref="TcpListener"/> has failed to stop.
13481355
/// </exception>
13491356
public void Stop ()
@@ -1404,7 +1411,7 @@ public void Stop ()
14041411
/// <paramref name="reason"/> could not be UTF-8-encoded.
14051412
/// </para>
14061413
/// </exception>
1407-
/// <exception cref="SocketException">
1414+
/// <exception cref="InvalidOperationException">
14081415
/// The underlying <see cref="TcpListener"/> has failed to stop.
14091416
/// </exception>
14101417
public void Stop (ushort code, string reason)
@@ -1484,7 +1491,7 @@ public void Stop (ushort code, string reason)
14841491
/// <paramref name="reason"/> could not be UTF-8-encoded.
14851492
/// </para>
14861493
/// </exception>
1487-
/// <exception cref="SocketException">
1494+
/// <exception cref="InvalidOperationException">
14881495
/// The underlying <see cref="TcpListener"/> has failed to stop.
14891496
/// </exception>
14901497
public void Stop (CloseStatusCode code, string reason)

0 commit comments

Comments
 (0)