[Spice-devel] [spice-server 3/3] Set TCP_KEEPINTVL when enabling TCP keepalive

Frediano Ziglio fziglio at redhat.com
Thu Mar 10 16:14:24 UTC 2016


> Otherwise we are only changing the timeout before the first keepalive
> probe is sent.
> ---
>  server/reds.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/server/reds.c b/server/reds.c
> index b1e1139..3cc6d48 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -2309,6 +2309,14 @@ static bool reds_init_keepalive(int socket)
>          }
>      }
>  
> +    if (setsockopt(socket, SOL_TCP, TCP_KEEPINTVL,
> +                   &keepalive_timeout, sizeof(keepalive_timeout)) == -1) {
> +        if (errno != ENOTSUP) {
> +            spice_printerr("setsockopt for keepalive interval failed, %s",
> strerror(errno));
> +            return false;
> +        }
> +    }
> +
>      return true;
>  }
>  

Nack.

The idea is that your connection should be active so after some time you start
testing the connection. The interval was meant to repeat the test in case of
network issues (which should be unlikely). So timeout for activeness test while
interval for issues. For instance the defaults are 7200/75 (timeout/interval).
See tcp(7).

Frediano


More information about the Spice-devel mailing list