@@ -641,7 +641,8 @@ private static void readPayloadDataAsync (
641641 Stream stream ,
642642 WebSocketFrame frame ,
643643 Action < WebSocketFrame > completed ,
644- Action < Exception > error )
644+ Action < Exception > error
645+ )
645646 {
646647 var len = frame . FullPayloadLength ;
647648 if ( len == 0 ) {
@@ -651,18 +652,22 @@ private static void readPayloadDataAsync (
651652 return ;
652653 }
653654
654- if ( len > PayloadData . MaxLength )
655- throw new WebSocketException ( CloseStatusCode . TooBig , "A frame has a long payload length." ) ;
655+ if ( len > PayloadData . MaxLength ) {
656+ var msg = "A frame has too long payload data length." ;
657+ throw new WebSocketException ( CloseStatusCode . TooBig , msg ) ;
658+ }
656659
657660 var llen = ( long ) len ;
658- Action < byte [ ] > compl = bytes => {
659- if ( bytes . LongLength != llen )
660- throw new WebSocketException (
661- "The payload data of a frame cannot be read from the stream." ) ;
661+ Action < byte [ ] > compl =
662+ bytes => {
663+ if ( bytes . LongLength != llen ) {
664+ var msg = "The payload data of a frame could not be read." ;
665+ throw new WebSocketException ( msg ) ;
666+ }
662667
663- frame . _payloadData = new PayloadData ( bytes , llen ) ;
664- completed ( frame ) ;
665- } ;
668+ frame . _payloadData = new PayloadData ( bytes , llen ) ;
669+ completed ( frame ) ;
670+ } ;
666671
667672 if ( frame . _payloadLength < 127 ) {
668673 stream . ReadBytesAsync ( ( int ) len , compl , error ) ;
0 commit comments