Cancel session if a bad message is received
This commit is contained in:
parent
8e1da8c190
commit
10b2a55df1
|
@ -366,9 +366,11 @@ namespace Ooui
|
||||||
|
|
||||||
if (receiveResult.MessageType == WebSocketMessageType.Close) {
|
if (receiveResult.MessageType == WebSocketMessageType.Close) {
|
||||||
await webSocket.CloseAsync (WebSocketCloseStatus.NormalClosure, "", token).ConfigureAwait (false);
|
await webSocket.CloseAsync (WebSocketCloseStatus.NormalClosure, "", token).ConfigureAwait (false);
|
||||||
|
sessionCts.Cancel ();
|
||||||
}
|
}
|
||||||
else if (receiveResult.MessageType == WebSocketMessageType.Binary) {
|
else if (receiveResult.MessageType == WebSocketMessageType.Binary) {
|
||||||
await webSocket.CloseAsync (WebSocketCloseStatus.InvalidMessageType, "Cannot accept binary frame", token).ConfigureAwait (false);
|
await webSocket.CloseAsync (WebSocketCloseStatus.InvalidMessageType, "Cannot accept binary frame", token).ConfigureAwait (false);
|
||||||
|
sessionCts.Cancel ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var size = receiveResult.Count;
|
var size = receiveResult.Count;
|
||||||
|
|
Loading…
Reference in New Issue