Title: [165878] releases/WebKitGTK/webkit-2.2/Source/WebKit2
Revision
165878
Author
[email protected]
Date
2014-03-19 01:23:38 -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.2/Source/WebKit2/ChangeLog (165877 => 165878)


--- releases/WebKitGTK/webkit-2.2/Source/WebKit2/ChangeLog	2014-03-19 08:04:52 UTC (rev 165877)
+++ releases/WebKitGTK/webkit-2.2/Source/WebKit2/ChangeLog	2014-03-19 08:23:38 UTC (rev 165878)
@@ -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-02-27  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Web Inspector doesn't work with network process enabled

Modified: releases/WebKitGTK/webkit-2.2/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp (165877 => 165878)


--- releases/WebKitGTK/webkit-2.2/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp	2014-03-19 08:04:52 UTC (rev 165877)
+++ releases/WebKitGTK/webkit-2.2/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp	2014-03-19 08:23:38 UTC (rev 165878)
@@ -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/OwnArrayPtr.h>
@@ -555,9 +556,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