From bb6624d5906a113c79cd283df1c87b992f051aa3 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Thu, 3 Feb 2011 19:53:48 +0200 Subject: [PATCH] Send alive message at least 3 times before expiry We want to re-announce at least 3 times before the resource group expires to cope with the unrelialble nature of UDP. Read the paragraphs about 'CACHE-CONTROL' on pages 21-22 of UPnP Device Architecture Document v1.1 for further details on this. --- libgssdp/gssdp-resource-group.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libgssdp/gssdp-resource-group.c b/libgssdp/gssdp-resource-group.c index 019b038..5e8aab9 100644 --- a/libgssdp/gssdp-resource-group.c +++ b/libgssdp/gssdp-resource-group.c @@ -503,10 +503,15 @@ gssdp_resource_group_set_available (GSSDPResourceGroup *resource_group, GMainContext *context; int timeout; - /* We want to re-announce before actually timing out */ + /* We want to re-announce at least 3 times before the resource + * group expires to cope with the unrelialble nature of UDP. + * + * Read the paragraphs about 'CACHE-CONTROL' on pages 21-22 of + * UPnP Device Architecture Document v1.1 for further details. + * */ timeout = resource_group->priv->max_age; - if (timeout > 2) - timeout = timeout / 2 - 1; + if (G_LIKELY (timeout > 6)) + timeout = (timeout / 3) - 1; /* Add re-announcement timer */ resource_group->priv->timeout_src = -- 2.7.4