[Modify] Polish it

This commit is contained in:
sta 2019-08-15 22:09:48 +09:00
parent 1c52fb72aa
commit ced5db7f35

View File

@ -558,7 +558,9 @@ Extended Payload Length: {7}
); );
} }
private static WebSocketFrame readMaskingKey (Stream stream, WebSocketFrame frame) private static WebSocketFrame readMaskingKey (
Stream stream, WebSocketFrame frame
)
{ {
var len = frame.IsMasked ? 4 : 0; var len = frame.IsMasked ? 4 : 0;
if (len == 0) { if (len == 0) {
@ -567,8 +569,10 @@ Extended Payload Length: {7}
} }
var bytes = stream.ReadBytes (len); var bytes = stream.ReadBytes (len);
if (bytes.Length != len) if (bytes.Length != len) {
throw new WebSocketException ("The masking key of a frame cannot be read from the stream."); var msg = "The masking key of a frame could not be read.";
throw new WebSocketException (msg);
}
frame._maskingKey = bytes; frame._maskingKey = bytes;
return frame; return frame;