[Modify] Polish it

This commit is contained in:
sta 2019-08-29 21:35:42 +09:00
parent deb476f733
commit 58b9cb12f4

View File

@ -625,20 +625,20 @@ Extended Payload Length: {7}
Stream stream, WebSocketFrame frame Stream stream, WebSocketFrame frame
) )
{ {
var fullLen = frame.ExactPayloadLength; var exactLen = frame.ExactPayloadLength;
if (fullLen > PayloadData.MaxLength) { if (exactLen > PayloadData.MaxLength) {
var msg = "A frame has too long payload length."; var msg = "A frame has too long payload length.";
throw new WebSocketException (CloseStatusCode.TooBig, msg); throw new WebSocketException (CloseStatusCode.TooBig, msg);
} }
if (fullLen == 0) { if (exactLen == 0) {
frame._payloadData = PayloadData.Empty; frame._payloadData = PayloadData.Empty;
return frame; return frame;
} }
var len = (long) fullLen; var len = (long) exactLen;
var bytes = frame._payloadLength < 127 var bytes = frame._payloadLength < 127
? stream.ReadBytes ((int) fullLen) ? stream.ReadBytes ((int) exactLen)
: stream.ReadBytes (len, 1024); : stream.ReadBytes (len, 1024);
if (bytes.LongLength != len) { if (bytes.LongLength != len) {