[Spice-devel] [PATCH spice-gtk] spice-channel: setsockopt TCP_NODELAY

Marc-André Lureau mlureau at redhat.com
Thu Dec 22 06:24:04 PST 2011


ack

----- Mensaje original -----
> 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>
> ---
>  gtk/spice-channel.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 84d4dfd..079028a 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>
> @@ -1925,6 +1926,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);
>  
> @@ -1960,8 +1962,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");
> @@ -2037,6 +2037,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);
>  
> --
> 1.7.7.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list