[Modify] Polish it
This commit is contained in:
parent
011fc19269
commit
d2bb267306
@ -631,36 +631,21 @@ Extended Payload Length: {7}
|
||||
CloseStatusCode.TooBig,
|
||||
"The length of 'Payload Data' of a frame is greater than the allowable max length.");
|
||||
|
||||
if (frame._payloadLength < 127) {
|
||||
var ilen = (int) len;
|
||||
stream.ReadBytesAsync (
|
||||
ilen,
|
||||
bytes => {
|
||||
if (bytes.Length != ilen)
|
||||
Action<byte[]> compl = bytes => {
|
||||
if (bytes.LongLength != (long) len)
|
||||
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);
|
||||
};
|
||||
|
||||
if (frame._payloadLength < 127) {
|
||||
stream.ReadBytesAsync ((int) len, compl, error);
|
||||
return;
|
||||
}
|
||||
|
||||
var llen = (long) len;
|
||||
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);
|
||||
stream.ReadBytesAsync ((long) len, 1024, compl, error);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user