diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index eac5a1e6..60c82c67 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -622,45 +622,11 @@ namespace WebSocketSharp internal static void ReadBytesAsync ( this Stream stream, int length, Action completed, Action error) - { - var buff = new byte[length]; - stream.BeginRead ( - buff, - 0, - length, - ar => { - try { - byte[] bytes = null; - try { - var len = stream.EndRead (ar); - bytes = len < 1 - ? WebSocket.EmptyBytes - : len < length - ? stream.readBytes (buff, len, length - len) - : buff; - } - catch { - bytes = WebSocket.EmptyBytes; - } - - if (completed != null) - completed (bytes); - } - catch (Exception ex) { - if (error != null) - error (ex); - } - }, - null); - } - - internal static void ReadBytesAsync2 ( - this Stream stream, int length, Action completed, Action error) { stream.readBytesAsync (new byte[length], 0, length, completed, error); } - internal static void ReadBytesAsync2 ( + internal static void ReadBytesAsync ( this Stream stream, long length, int bufferLength,