Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2289)

Unified Diff: Source/modules/websockets/NewWebSocketChannelImpl.cpp

Issue 46143003: NewWebSocketChannel sends a message endlessly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/NewWebSocketChannelImpl.cpp
diff --git a/Source/modules/websockets/NewWebSocketChannelImpl.cpp b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
index 1f04b2a847f0e5855e91bce8bac5ce44dab417cd..1fb08ec1a35b267c71a65fdd0c0baba02551892b 100644
--- a/Source/modules/websockets/NewWebSocketChannelImpl.cpp
+++ b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
@@ -302,7 +302,7 @@ void NewWebSocketChannelImpl::sendInternal()
WebSocketHandle::MessageType type =
m_sentSizeOfTopMessage ? WebSocketHandle::MessageTypeContinuation : WebSocketHandle::MessageTypeText;
size_t size = std::min(static_cast<size_t>(m_sendingQuota), message.text.length() - m_sentSizeOfTopMessage);
- final = (static_cast<size_t>(m_sendingQuota) == size);
+ final = (m_sentSizeOfTopMessage + size == message.text.length());
m_handle->send(final, type, message.text.data() + m_sentSizeOfTopMessage, size);
m_sentSizeOfTopMessage += size;
m_sendingQuota -= size;
@@ -316,7 +316,7 @@ void NewWebSocketChannelImpl::sendInternal()
WebSocketHandle::MessageType type =
m_sentSizeOfTopMessage ? WebSocketHandle::MessageTypeContinuation : WebSocketHandle::MessageTypeBinary;
size_t size = std::min(static_cast<size_t>(m_sendingQuota), message.arrayBuffer->byteLength() - m_sentSizeOfTopMessage);
- final = (static_cast<size_t>(m_sendingQuota) == size);
+ final = (m_sentSizeOfTopMessage + size == message.arrayBuffer->byteLength());
m_handle->send(final, type, static_cast<const char*>(message.arrayBuffer->data()) + m_sentSizeOfTopMessage, size);
m_sentSizeOfTopMessage += size;
m_sendingQuota -= size;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698