[Modify] Polish it

master
sta 10 years ago
parent 011fc19269
commit d2bb267306

@ -631,36 +631,21 @@ Extended Payload Length: {7}
CloseStatusCode.TooBig, CloseStatusCode.TooBig,
"The length of 'Payload Data' of a frame is greater than the allowable max length."); "The length of 'Payload Data' of a frame is greater than the allowable max length.");
if (frame._payloadLength < 127) { Action<byte[]> compl = bytes => {
var ilen = (int) len; if (bytes.LongLength != (long) len)
stream.ReadBytesAsync ( throw new WebSocketException (
ilen, "The 'Payload Data' of a frame cannot be read from the data source.");
bytes => {
if (bytes.Length != ilen) frame._payloadData = new PayloadData (bytes, frame.IsMasked);
throw new WebSocketException ( completed (frame);
"The 'Payload Data' of a frame cannot be read from the data source."); };
frame._payloadData = new PayloadData (bytes, frame.IsMasked);
completed (frame);
},
error);
if (frame._payloadLength < 127) {
stream.ReadBytesAsync ((int) len, compl, error);
return; return;
} }
var llen = (long) len; stream.ReadBytesAsync ((long) len, 1024, compl, error);
stream.ReadBytesAsync (
llen,
1024,
bytes => {
if (bytes.LongLength != llen)
throw new WebSocketException (
"The 'Payload Data' of a frame cannot be read from the data source.");
frame._payloadData = new PayloadData (bytes, frame.IsMasked);
completed (frame);
},
error);
} }
#endregion #endregion

Loading…
Cancel
Save