[Modify] Polish it
This commit is contained in:
parent
24901cd01b
commit
24f65e4d72
@ -518,7 +518,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.ExtendedPayloadLengthCount;
|
var len = frame.ExtendedPayloadLengthCount;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@ -531,14 +532,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 extended payload length of a frame could not be read.";
|
||||||
"The extended payload length of a frame cannot be read from the stream.");
|
throw new WebSocketException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
frame._extPayloadLength = bytes;
|
frame._extPayloadLength = bytes;
|
||||||
completed (frame);
|
completed (frame);
|
||||||
},
|
},
|
||||||
error);
|
error
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WebSocketFrame readHeader (Stream stream)
|
private static WebSocketFrame readHeader (Stream stream)
|
||||||
|
Loading…
Reference in New Issue
Block a user