[Modify] Polish it
This commit is contained in:
parent
e44a6c799f
commit
6357649fe5
@ -641,7 +641,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.FullPayloadLength;
|
var len = frame.FullPayloadLength;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@ -651,14 +652,18 @@ Extended Payload Length: {7}
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len > PayloadData.MaxLength)
|
if (len > PayloadData.MaxLength) {
|
||||||
throw new WebSocketException (CloseStatusCode.TooBig, "A frame has a long payload length.");
|
var msg = "A frame has too long payload data length.";
|
||||||
|
throw new WebSocketException (CloseStatusCode.TooBig, msg);
|
||||||
|
}
|
||||||
|
|
||||||
var llen = (long) len;
|
var llen = (long) len;
|
||||||
Action<byte[]> compl = bytes => {
|
Action<byte[]> compl =
|
||||||
if (bytes.LongLength != llen)
|
bytes => {
|
||||||
throw new WebSocketException (
|
if (bytes.LongLength != llen) {
|
||||||
"The payload data of a frame cannot be read from the stream.");
|
var msg = "The payload data of a frame could not be read.";
|
||||||
|
throw new WebSocketException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
frame._payloadData = new PayloadData (bytes, llen);
|
frame._payloadData = new PayloadData (bytes, llen);
|
||||||
completed (frame);
|
completed (frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user