summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-12-22 12:20:03 +0100
committerHans de Goede <hdegoede@redhat.com>2011-12-22 16:04:04 +0100
commit546dad3a0adf35c5115a12f516bdefde82704e5d (patch)
treefe03b7e7954aa2d20c4ef589b0220ace02f35bb6
parentc5f42f8fb31c371548107ddf4114115d0e269946 (diff)
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@redhat.com>
-rw-r--r--gtk/spice-channel.c11
1 files changed, 9 insertions, 2 deletions
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);