Title: [165874] releases/WebKitGTK/webkit-2.4/Source/WebKit2
Revision
165874
Author
[email protected]
Date
2014-03-19 00:12:35 -0700 (Wed, 19 Mar 2014)

Log Message

Merge r165745 - [GTK] Don't busy loop when the socket is full
https://bugs.webkit.org/show_bug.cgi?id=129802

Patch by Giovanni Campagna <[email protected]> on 2014-03-17
Reviewed by Carlos Garcia Campos.

When the socket is full and we see EAGAIN or EWOULDBLOCK
(because the socket is non blocking), don't busy loop by
tring to write again, instead poll() until the socket
becomes writable.

* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::sendOutgoingMessage):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog (165873 => 165874)


--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog	2014-03-19 06:57:17 UTC (rev 165873)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/ChangeLog	2014-03-19 07:12:35 UTC (rev 165874)
@@ -1,3 +1,18 @@
+2014-03-17  Giovanni Campagna  <[email protected]>
+
+        [GTK] Don't busy loop when the socket is full
+        https://bugs.webkit.org/show_bug.cgi?id=129802
+
+        Reviewed by Carlos Garcia Campos.
+
+        When the socket is full and we see EAGAIN or EWOULDBLOCK
+        (because the socket is non blocking), don't busy loop by
+        tring to write again, instead poll() until the socket
+        becomes writable.
+
+        * Platform/IPC/unix/ConnectionUnix.cpp:
+        (IPC::Connection::sendOutgoingMessage):
+
 2014-03-14  Carlos Garcia Campos  <[email protected]>
 
         [GTK] WebKit2WebExtension GIR can't be used in vala

Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp (165873 => 165874)


--- releases/WebKitGTK/webkit-2.4/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp	2014-03-19 06:57:17 UTC (rev 165873)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp	2014-03-19 07:12:35 UTC (rev 165874)
@@ -34,6 +34,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <poll.h>
 #include <wtf/Assertions.h>
 #include <wtf/Functional.h>
 #include <wtf/StdLibExtras.h>
@@ -522,9 +523,18 @@
 
     int bytesSent = 0;
     while ((bytesSent = sendmsg(m_socketDescriptor, &message, 0)) == -1) {
-        if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
+        if (errno == EINTR)
             continue;
+        if (errno == EAGAIN || errno == EWOULDBLOCK) {
+            struct pollfd pollfd;
 
+            pollfd.fd = m_socketDescriptor;
+            pollfd.events = POLLOUT;
+            pollfd.revents = 0;
+            poll(&pollfd, 1, -1);
+            continue;
+        }
+
         WTFLogAlways("Error sending IPC message: %s", strerror(errno));
         return false;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to