2009-12-16 Fumitoshi Ukai <ukai@chromium.org>
[WebKit-https.git] / WebCore / websockets / WebSocketChannel.cpp
index 07b63d1..5c0f4c3 100644 (file)
@@ -150,7 +150,7 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da
         handle->close();
         return;
     }
         handle->close();
         return;
     }
-    if (m_handshake.mode() != WebSocketHandshake::Connected) {
+    if (m_handshake.mode() == WebSocketHandshake::Incomplete) {
         int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize);
         if (headerLength <= 0)
             return;
         int headerLength = m_handshake.readServerHandshake(m_buffer, m_bufferSize);
         if (headerLength <= 0)
             return;
@@ -179,6 +179,8 @@ void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* da
             return;
         LOG(Network, "remaining in read buf %ul", m_bufferSize);
     }
             return;
         LOG(Network, "remaining in read buf %ul", m_bufferSize);
     }
+    if (m_handshake.mode() != WebSocketHandshake::Connected)
+        return;
 
     const char* nextFrame = m_buffer;
     const char* p = m_buffer;
 
     const char* nextFrame = m_buffer;
     const char* p = m_buffer;