[gupnp/gupnp-0.18: 15/20] gupnp-service-proxy: check timeout value before using it
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp/gupnp-0.18: 15/20] gupnp-service-proxy: check timeout value before using it
- Date: Sat, 17 Mar 2012 11:53:03 +0000 (UTC)
commit de5c09a4157b7aab1bee7c832a6778a4d78b8c0e
Author: Sven Neumann <s neumann raumfeld com>
Date: Wed Jan 11 23:05:47 2012 +0100
gupnp-service-proxy: check timeout value before using it
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]