[Spice-devel] [PATCH spice] spicevmc: Set sockopt nodelay for usbredir channels
Hans de Goede
hdegoede at redhat.com
Thu Dec 22 03:14:14 PST 2011
We want as little latency as possible with usb channels.
Signed-off-by: Hans de goede <hdegoede at redhat.com>
---
server/spicevmc.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/server/spicevmc.c b/server/spicevmc.c
index b1a7d8d..70cfe0e 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,18 @@ 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) {
+ printf("bingo\n");
+ 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;
}
--
1.7.7.4
More information about the Spice-devel
mailing list