From 9ba9f666bbfd636da8580717e98a0ada17ec8f9e Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Fri, 7 Mar 2014 22:25:21 -0800 Subject: [PATCH] Fix continuation frame bug. --- src/Microsoft.Net.WebSockets/CommonWebSocket.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.Net.WebSockets/CommonWebSocket.cs b/src/Microsoft.Net.WebSockets/CommonWebSocket.cs index 6930e38c4e..2f4c405c36 100644 --- a/src/Microsoft.Net.WebSockets/CommonWebSocket.cs +++ b/src/Microsoft.Net.WebSockets/CommonWebSocket.cs @@ -171,11 +171,6 @@ namespace Microsoft.Net.WebSockets opCode = _firstDataOpCode.Value; } - if (_frameInProgress.Fin) - { - _firstDataOpCode = null; - } - if (opCode == Constants.OpCodes.CloseFrame) { return await ProcessCloseFrameAsync(cancellationToken); @@ -188,6 +183,10 @@ namespace Microsoft.Net.WebSockets { // End of an empty frame? result = new WebSocketReceiveResult(0, messageType, _frameInProgress.Fin); + if (_frameInProgress.Fin) + { + _firstDataOpCode = null; + } _frameInProgress = null; return result; } @@ -207,6 +206,10 @@ namespace Microsoft.Net.WebSockets if (bytesToCopy == _frameBytesRemaining) { result = new WebSocketReceiveResult(bytesToCopy, messageType, _frameInProgress.Fin); + if (_frameInProgress.Fin) + { + _firstDataOpCode = null; + } _frameInProgress = null; } else