[Spice-devel] [PATCH vdagent 10/11] udscs: Add udscs_is_write_pending()

Jakub Janků janku.jakub.jj at gmail.com
Tue Sep 26 20:59:46 UTC 2017


This is necessary for the following GMainLoop integration.
---
 src/udscs.c | 6 ++++++
 src/udscs.h | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/src/udscs.c b/src/udscs.c
index 2761cbb..4a0e193 100644
--- a/src/udscs.c
+++ b/src/udscs.c
@@ -359,6 +359,12 @@ int udscs_client_get_fd(struct udscs_connection *conn)
     return conn->fd;
 }
 
+gboolean udscs_is_write_pending(struct udscs_connection *conn)
+{
+    g_return_val_if_fail(conn != NULL, FALSE);
+    return (conn->write_buf != NULL);
+}
+
 #ifndef UDSCS_NO_SERVER
 
 /* ---------- Server-side implementation ---------- */
diff --git a/src/udscs.h b/src/udscs.h
index 08e71c8..a8ca952 100644
--- a/src/udscs.h
+++ b/src/udscs.h
@@ -126,6 +126,10 @@ void udscs_do_read(struct udscs_connection **connp);
  */
 void udscs_do_write(struct udscs_connection **connp);
 
+/* Return TRUE if there's some data in the write buffer to be written,
+ * otherwise return FALSE.
+ */
+gboolean udscs_is_write_pending(struct udscs_connection *conn);
 
 #ifndef UDSCS_NO_SERVER
 
-- 
2.13.5



More information about the Spice-devel mailing list