[RFC wayland 06/18] client: Check remaining connection buffer status after each queue_event()

Derek Foreman derekf at osg.samsung.com
Tue Feb 9 16:55:53 UTC 2016


Currently we (correctly) assume that event_queue() consumes exactly the
amount of connection data as the size returned.

In a follow up patch I change that to allow bulk transfer of fd contents
which may deplete the connection buffer (and read even more directly).

In preparation for that, start checking the remaining buffer contents
directly.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 src/wayland-client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index ef12bfc..5c5ecd3 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1309,7 +1309,8 @@ read_events(struct wl_display *display)
 			return -1;
 		}
 
-		for (rem = total; rem >= 8; rem -= size) {
+		rem = total;
+		while (rem >= 8) {
 			size = queue_event(display, rem);
 			if (size == -1) {
 				display_fatal_error(display, errno);
@@ -1317,6 +1318,7 @@ read_events(struct wl_display *display)
 			} else if (size == 0) {
 				break;
 			}
+			rem = wl_connection_pending_input(display->connection);
 		}
 
 		display_wakeup_threads(display);
-- 
2.7.0



More information about the wayland-devel mailing list