[Modify] Polish it

This commit is contained in:
sta 2015-10-15 15:49:08 +09:00
parent fef4747e26
commit 1d645fe8f0
3 changed files with 5 additions and 10 deletions

View File

@ -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 ();
}

View File

@ -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

View File

@ -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 ();