Re: [PATCH] gupnp-service-proxy: check timeout value before using it



On Mi, 2012-01-11 at 23:05 +0100, Sven Neumann wrote:

Sorry for the delay. Yes, well spotted. Thank you & pushed.

> Move the sanity check for the parsed timeout value before the calculation
> of the timeout to use for re-subscription. Otherwise we will likely end up
> renewing the subscription too late in the error case.
> 
> Signed-off-by: Sven Neumann <s neumann raumfeld com>
> ---
>  libgupnp/gupnp-service-proxy.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
> index 87555e9..c39e9c9 100644
> --- a/libgupnp/gupnp-service-proxy.c
> +++ b/libgupnp/gupnp-service-proxy.c
> @@ -1949,10 +1949,6 @@ subscribe_got_response (SoupSession       *session,
>                          /* We have a finite timeout */
>                          timeout = atoi (hdr + strlen ("Second-"));
>  
> -                        /* We want to resubscribe before the subscription
> -                         * expires. */
> -                        timeout = g_random_int_range (1, timeout / 2);
> -
>                          if (timeout < 0) {
>                                  g_warning ("Invalid time-out specified. "
>                                             "Assuming default value of %d.",
> @@ -1961,6 +1957,10 @@ subscribe_got_response (SoupSession       *session,
>                                  timeout = GENA_DEFAULT_TIMEOUT;
>                          }
>  
> +                        /* We want to resubscribe before the subscription
> +                         * expires. */
> +                        timeout = g_random_int_range (1, timeout / 2);
> +
>                          /* Add actual timeout */
>                          proxy->priv->subscription_timeout_src =
>                                  g_timeout_source_new_seconds (timeout);




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]