[Modify] Polish it
This commit is contained in:
parent
ced5db7f35
commit
fcc14146d9
@ -582,7 +582,8 @@ Extended Payload Length: {7}
|
|||||||
Stream stream,
|
Stream stream,
|
||||||
WebSocketFrame frame,
|
WebSocketFrame frame,
|
||||||
Action<WebSocketFrame> completed,
|
Action<WebSocketFrame> completed,
|
||||||
Action<Exception> error)
|
Action<Exception> error
|
||||||
|
)
|
||||||
{
|
{
|
||||||
var len = frame.IsMasked ? 4 : 0;
|
var len = frame.IsMasked ? 4 : 0;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@ -595,14 +596,16 @@ Extended Payload Length: {7}
|
|||||||
stream.ReadBytesAsync (
|
stream.ReadBytesAsync (
|
||||||
len,
|
len,
|
||||||
bytes => {
|
bytes => {
|
||||||
if (bytes.Length != len)
|
if (bytes.Length != len) {
|
||||||
throw new WebSocketException (
|
var msg = "The masking key of a frame could not be read.";
|
||||||
"The masking key of a frame cannot be read from the stream.");
|
throw new WebSocketException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
frame._maskingKey = bytes;
|
frame._maskingKey = bytes;
|
||||||
completed (frame);
|
completed (frame);
|
||||||
},
|
},
|
||||||
error);
|
error
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WebSocketFrame readPayloadData (Stream stream, WebSocketFrame frame)
|
private static WebSocketFrame readPayloadData (Stream stream, WebSocketFrame frame)
|
||||||
|
Loading…
Reference in New Issue
Block a user