diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index f0ec2d8d..4e041a13 100644 --- a/websocket-sharp/Ext.cs +++ b/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 (); } diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index b4561d7f..02d61be1 100644 --- a/websocket-sharp/WebSocket.cs +++ b/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 diff --git a/websocket-sharp/WebSocketFrame.cs b/websocket-sharp/WebSocketFrame.cs index 0eeddc08..5ff0b833 100644 --- a/websocket-sharp/WebSocketFrame.cs +++ b/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 ();