REGRESSION(r204512): WebSocket errors with "Failed to send WebSocket frame." if...
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 18:15:22 +0000 (18:15 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 18:15:22 +0000 (18:15 +0000)
commit5a82d1a8eaa2c97810d3c1effbe4530e8673afbe
tree7f0548a44f2559e992adc462f7943a4fd149fa9f
parent815b69d5439a1fb9b89ce7f1ff95cbcc7182af76
REGRESSION(r204512): WebSocket errors with "Failed to send WebSocket frame."  if too much data is sent
https://bugs.webkit.org/show_bug.cgi?id=170463

Reviewed by Michael Catanzaro.

This only reproduces when using WebSockets to communicate with an external server.
When communicating with a local server, CFWriteStreamWrite succeeds too reliably, so
CFWriteStreamCanAcceptBytes returns true, when sometimes it doesn't when communicating
across the real internet.

* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::platformSendInternal):
* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::platformSendInternal):
Returning std::nullopt means there was an error, which is not true when the socket stream
is in a state where it cannot be written to because it is actively communicating.
Returning 0 means 0 new bytes were sent, so we will try again later.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp
Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp