Bug 675961 - Websockets: error in removing processed control frame from buffered fragment sequence. r=jduell
authorPatrick McManus <mcmanus@ducksong.com>
Thu, 04 Aug 2011 22:43:52 -0700
changeset 73895 840fd3069d1fecb1a7aeed20544dd26411d2ffcb
parent 73894 6bcb177d3402b3def96bb7c46ca99c07a071dba1
child 73896 cd0106ceb8ce337636875ef7b1f0d143cb33b7a4
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjduell
bugs675961
milestone8.0a1
Bug 675961 - Websockets: error in removing processed control frame from buffered fragment sequence. r=jduell
netwerk/protocol/websocket/WebSocketChannel.cpp
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -926,19 +926,19 @@ WebSocketChannel::ProcessInput(PRUint8 *
         // Remove the control frame from the stream so we have a contiguous
         // data buffer of reassembled fragments
         LOG(("WebSocketChannel:: Removing Control From Read buffer\n"));
         NS_ABORT_IF_FALSE(mFramePtr + framingLength == payload,
                           "payload offset from frameptr wrong");
         ::memmove(mFramePtr, payload + payloadLength, avail - payloadLength);
         payload = mFramePtr;
         avail -= payloadLength;
-        payloadLength = 0;
         if (mBuffered)
           mBuffered -= framingLength + payloadLength;
+        payloadLength = 0;
       }
     } else if (opcode == kBinary) {
       LOG(("WebSocketChannel:: binary frame received\n"));
       if (mListener) {
         nsCString binaryData((const char *)payload, payloadLength);
         NS_DispatchToMainThread(new CallOnMessageAvailable(mListener, mContext,
                                                            binaryData,
                                                            payloadLength));