[Spice-commits] gtk/spice-channel.c

Hans de Goede jwrdegoede at kemper.freedesktop.org
Thu Dec 22 07:05:40 PST 2011


 gtk/spice-channel.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 546dad3a0adf35c5115a12f516bdefde82704e5d
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Dec 22 12:20:03 2011 +0100

    spice-channel: setsockopt TCP_NODELAY
    
    spicec does this for all channels, and it seems like a good idea to do the
    same in spice-gtk.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index cbd89e1..f4c398d 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -33,6 +33,7 @@
 #endif
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#include <netinet/tcp.h> // TCP_NODELAY
 #endif
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
@@ -1899,6 +1900,7 @@ static void *spice_channel_coroutine(void *data)
     SpiceChannel *channel = SPICE_CHANNEL(data);
     SpiceChannelPrivate *c = channel->priv;
     guint verify;
+    int rc, delay_val = 1;
 
     SPICE_DEBUG("Started background coroutine %p for %s", &c->coroutine, c->name);
 
@@ -1934,8 +1936,6 @@ reconnect:
     c->has_error = FALSE;
 
     if (c->tls) {
-        int rc;
-
         c->ctx = SSL_CTX_new(TLSv1_method());
         if (c->ctx == NULL) {
             g_critical("SSL_CTX_new failed");
@@ -2011,6 +2011,13 @@ ssl_reconnect:
     }
 
 connected:
+    rc = setsockopt(g_socket_get_fd(c->sock), IPPROTO_TCP, TCP_NODELAY,
+                    &delay_val, sizeof(delay_val));
+    if (rc != 0) {
+        g_warning("%s: could not set sockopt TCP_NODELAY: %s", c->name,
+                  strerror(errno));
+    }
+
     c->state = SPICE_CHANNEL_STATE_LINK_HDR;
     spice_channel_send_link(channel);
 


More information about the Spice-commits mailing list