[Modify] Polish it

This commit is contained in:
sta 2019-08-14 22:12:46 +09:00
parent 24901cd01b
commit 24f65e4d72

View File

@ -518,7 +518,8 @@ Extended Payload Length: {7}
Stream stream,
WebSocketFrame frame,
Action<WebSocketFrame> completed,
Action<Exception> error)
Action<Exception> error
)
{
var len = frame.ExtendedPayloadLengthCount;
if (len == 0) {
@ -531,14 +532,16 @@ Extended Payload Length: {7}
stream.ReadBytesAsync (
len,
bytes => {
if (bytes.Length != len)
throw new WebSocketException (
"The extended payload length of a frame cannot be read from the stream.");
if (bytes.Length != len) {
var msg = "The extended payload length of a frame could not be read.";
throw new WebSocketException (msg);
}
frame._extPayloadLength = bytes;
completed (frame);
},
error);
error
);
}
private static WebSocketFrame readHeader (Stream stream)