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