Browse Source

[Modify] Polish it

pull/172/head
sta 10 years ago
parent
commit
1d645fe8f0
  1. 11
      websocket-sharp/Ext.cs
  2. 2
      websocket-sharp/WebSocket.cs
  3. 2
      websocket-sharp/WebSocketFrame.cs

11
websocket-sharp/Ext.cs

@ -894,15 +894,10 @@ namespace WebSocketSharp
return Encoding.UTF8.GetBytes (s);
}
internal static void WriteBytes (this Stream stream, byte[] bytes)
internal static void WriteBytes (this Stream stream, byte[] bytes, int bufferLength)
{
using (var input = new MemoryStream (bytes))
input.CopyTo (stream, 1024);
}
internal static void WriteBytes (this Stream stream, byte[] bytes, int length)
{
stream.Write (bytes, 0, length);
input.CopyTo (stream, bufferLength);
}
internal static void WriteBytesAsync (
@ -1840,7 +1835,7 @@ namespace WebSocketSharp
if (len <= Int32.MaxValue)
output.Write (content, 0, (int) len);
else
output.WriteBytes (content);
output.WriteBytes (content, 1024);
output.Close ();
}

2
websocket-sharp/WebSocket.cs

@ -1058,7 +1058,7 @@ namespace WebSocketSharp
_inContinuation = true;
}
_fragmentsBuffer.WriteBytes (frame.PayloadData.ApplicationData);
_fragmentsBuffer.WriteBytes (frame.PayloadData.ApplicationData, 1024);
if (frame.IsFinal) {
using (_fragmentsBuffer) {
var data = _compression != CompressionMethod.None

2
websocket-sharp/WebSocketFrame.cs

@ -763,7 +763,7 @@ Extended Payload Length: {7}
if (_payloadLength < 127)
buff.Write (bytes, 0, bytes.Length);
else
buff.WriteBytes (bytes);
buff.WriteBytes (bytes, 1024);
}
buff.Close ();

Loading…
Cancel
Save