Fix for issue #16

This commit is contained in:
sta
2013-04-07 17:05:48 +09:00
parent 94cf881dcf
commit 57420387ff
20 changed files with 14 additions and 9 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14 -9
View File
@@ -313,17 +313,21 @@ namespace WebSocketSharp {
public static void ParseAsync(Stream stream, Action<WsFrame> completed)
{
ParseAsync(stream, true, completed);
ParseAsync(stream, true, completed, null);
}
public static void ParseAsync(Stream stream, bool unmask, Action<WsFrame> completed)
public static void ParseAsync(Stream stream, Action<WsFrame> completed, Action<Exception> error)
{
var headerLen = 2;
var header = new byte[headerLen];
ParseAsync(stream, true, completed, error);
}
AsyncCallback callback = (ar) =>
public static void ParseAsync(
Stream stream, bool unmask, Action<WsFrame> completed, Action<Exception> error)
{
var header = new byte[2];
AsyncCallback callback = ar =>
{
WsFrame frame;
WsFrame frame = null;
try
{
var readLen = stream.EndRead(ar);
@@ -331,9 +335,10 @@ namespace WebSocketSharp {
? parse(header, stream, unmask)
: null;
}
catch
catch (Exception ex)
{
frame = null;
if (!error.IsNull())
error(ex);
}
finally
{
@@ -342,7 +347,7 @@ namespace WebSocketSharp {
}
};
stream.BeginRead(header, 0, headerLen, callback, null);
stream.BeginRead(header, 0, 2, callback, null);
}
public void Print()
Binary file not shown.
Binary file not shown.