Fix continuation frame bug.

This commit is contained in:
Chris Ross 2014-03-07 22:25:21 -08:00
parent 6ecc36de5a
commit 9ba9f666bb
1 changed files with 8 additions and 5 deletions

View File

@ -171,11 +171,6 @@ namespace Microsoft.Net.WebSockets
opCode = _firstDataOpCode.Value; opCode = _firstDataOpCode.Value;
} }
if (_frameInProgress.Fin)
{
_firstDataOpCode = null;
}
if (opCode == Constants.OpCodes.CloseFrame) if (opCode == Constants.OpCodes.CloseFrame)
{ {
return await ProcessCloseFrameAsync(cancellationToken); return await ProcessCloseFrameAsync(cancellationToken);
@ -188,6 +183,10 @@ namespace Microsoft.Net.WebSockets
{ {
// End of an empty frame? // End of an empty frame?
result = new WebSocketReceiveResult(0, messageType, _frameInProgress.Fin); result = new WebSocketReceiveResult(0, messageType, _frameInProgress.Fin);
if (_frameInProgress.Fin)
{
_firstDataOpCode = null;
}
_frameInProgress = null; _frameInProgress = null;
return result; return result;
} }
@ -207,6 +206,10 @@ namespace Microsoft.Net.WebSockets
if (bytesToCopy == _frameBytesRemaining) if (bytesToCopy == _frameBytesRemaining)
{ {
result = new WebSocketReceiveResult(bytesToCopy, messageType, _frameInProgress.Fin); result = new WebSocketReceiveResult(bytesToCopy, messageType, _frameInProgress.Fin);
if (_frameInProgress.Fin)
{
_firstDataOpCode = null;
}
_frameInProgress = null; _frameInProgress = null;
} }
else else