[Spice-commits] server/spicevmc.c

Hans de Goede jwrdegoede at kemper.freedesktop.org
Thu Dec 22 03:48:36 PST 2011


 server/spicevmc.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 3435df1234a8bd3cca25ffd7e4b48f2142267a1c
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Dec 22 12:13:19 2011 +0100

    spicevmc: Set sockopt nodelay for usbredir channels
    
    We want as little latency as possible with usb channels.
    
    Signed-off-by: Hans de goede <hdegoede at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index b1a7d8d..bed8488 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -23,6 +23,10 @@
 #endif
 
 #include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <netinet/in.h> // IPPROTO_TCP
+#include <netinet/tcp.h> // TCP_NODELAY
 
 #include "server/char_device.h"
 #include "server/red_channel.h"
@@ -82,6 +86,17 @@ static void spicevmc_chardev_wakeup(SpiceCharDeviceInstance *sin)
 
 static int spicevmc_red_channel_client_config_socket(RedChannelClient *rcc)
 {
+    int delay_val = 1;
+    RedsStream *stream = red_channel_client_get_stream(rcc);
+
+    if (rcc->channel->type == SPICE_CHANNEL_USBREDIR) {
+        if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
+                &delay_val, sizeof(delay_val)) != 0) {
+            red_printf("setsockopt failed, %s", strerror(errno));
+            return FALSE;
+        }
+    }
+
     return TRUE;
 }
 


More information about the Spice-commits mailing list