diff options
author | apavlov@chromium.org <apavlov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 12:12:36 +0000 |
---|---|---|
committer | apavlov@chromium.org <apavlov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 12:12:36 +0000 |
commit | 45481e136cfee317f91af8b821ab39f878b0f21e (patch) | |
tree | 5f922feb960ec4969b1d0acae7b29a55328c9d1f /chrome/browser/debugger | |
parent | 58bfc6b074bf05e36f02a4349a6217b95f3b9c2c (diff) | |
download | chromium_src-45481e136cfee317f91af8b821ab39f878b0f21e.zip chromium_src-45481e136cfee317f91af8b821ab39f878b0f21e.tar.gz chromium_src-45481e136cfee317f91af8b821ab39f878b0f21e.tar.bz2 |
Handle EWOULDBLOCK/EAGAIN while sending ChromeDevTools protocol messages so that outbound protocol messages do not get silently dropped.
Review URL: http://codereview.chromium.org/147080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger')
-rw-r--r-- | chrome/browser/debugger/devtools_remote_listen_socket.cc | 18 | ||||
-rw-r--r-- | chrome/browser/debugger/devtools_remote_listen_socket.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.cc b/chrome/browser/debugger/devtools_remote_listen_socket.cc index 5b7bb21..bdc5203 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket.cc +++ b/chrome/browser/debugger/devtools_remote_listen_socket.cc @@ -22,6 +22,7 @@ #endif #include "base/eintr_wrapper.h" +#include "base/platform_thread.h" #include "base/string_util.h" #include "chrome/browser/debugger/devtools_remote.h" #include "chrome/browser/debugger/devtools_remote_message.h" @@ -243,6 +244,23 @@ void DevToolsRemoteListenSocket::Accept() { } } +void DevToolsRemoteListenSocket::SendInternal(const char* bytes, int len) { + int sent = HANDLE_EINTR(send(socket_, bytes, len, 0)); + if (sent == kSocketError) { +#if defined(OS_WIN) + while (WSAGetLastError() == WSAEWOULDBLOCK) { +#elif defined(OS_POSIX) + while (errno == EWOULDBLOCK || errno == EAGAIN) { +#endif + PlatformThread::YieldCurrentThread(); + sent = HANDLE_EINTR(send(socket_, bytes, len, 0)); + } + } + if (sent != len) { + LOG(ERROR) << "send failed: "; + } +} + void DevToolsRemoteListenSocket::Close() { ListenSocket::Close(); } diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.h b/chrome/browser/debugger/devtools_remote_listen_socket.h index 8c9db705..e2e0174 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket.h +++ b/chrome/browser/debugger/devtools_remote_listen_socket.h @@ -30,6 +30,7 @@ class DevToolsRemoteListenSocket : public ListenSocket { virtual void Accept(); virtual void Read(); virtual void Close(); + virtual void SendInternal(const char* bytes, int len); private: |