[Modify] Polish it
This commit is contained in:
		@@ -657,37 +657,37 @@ Extended Payload Length: {7}
 | 
				
			|||||||
      Action<Exception> error
 | 
					      Action<Exception> error
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      var len = frame.ExactPayloadLength;
 | 
					      var exactLen = frame.ExactPayloadLength;
 | 
				
			||||||
      if (len == 0) {
 | 
					      if (exactLen > PayloadData.MaxLength) {
 | 
				
			||||||
 | 
					        var msg = "A frame has too long payload length.";
 | 
				
			||||||
 | 
					        throw new WebSocketException (CloseStatusCode.TooBig, msg);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (exactLen == 0) {
 | 
				
			||||||
        frame._payloadData = PayloadData.Empty;
 | 
					        frame._payloadData = PayloadData.Empty;
 | 
				
			||||||
        completed (frame);
 | 
					        completed (frame);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (len > PayloadData.MaxLength) {
 | 
					      var len = (long) exactLen;
 | 
				
			||||||
        var msg = "A frame has too long payload length.";
 | 
					      Action<byte[]> comp =
 | 
				
			||||||
        throw new WebSocketException (CloseStatusCode.TooBig, msg);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var llen = (long) len;
 | 
					 | 
				
			||||||
      Action<byte[]> compl =
 | 
					 | 
				
			||||||
        bytes => {
 | 
					        bytes => {
 | 
				
			||||||
          if (bytes.LongLength != llen) {
 | 
					          if (bytes.LongLength != len) {
 | 
				
			||||||
            var msg = "The payload data of a frame could not be read.";
 | 
					            var msg = "The payload data of a frame could not be read.";
 | 
				
			||||||
            throw new WebSocketException (msg);
 | 
					            throw new WebSocketException (msg);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          frame._payloadData = new PayloadData (bytes, llen);
 | 
					          frame._payloadData = new PayloadData (bytes, len);
 | 
				
			||||||
          completed (frame);
 | 
					          completed (frame);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (frame._payloadLength < 127) {
 | 
					      if (frame._payloadLength < 127) {
 | 
				
			||||||
        stream.ReadBytesAsync ((int) len, compl, error);
 | 
					        stream.ReadBytesAsync ((int) exactLen, comp, error);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      stream.ReadBytesAsync (llen, 1024, compl, error);
 | 
					      stream.ReadBytesAsync (len, 1024, comp, error);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static string utf8Decode (byte[] bytes)
 | 
					    private static string utf8Decode (byte[] bytes)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user