[PATCH 2/2] Send alive/byebye announcements three times.
- From: Jens Georg <mail jensge org>
- To: gupnp-list gnome org
- Subject: [PATCH 2/2] Send alive/byebye announcements three times.
- Date: Tue, 14 Jun 2011 08:57:54 +0200
UPnP recommends to send the whole batch of announcements more than
once "due to the unreliable nature of UDP".
---
libgssdp/gssdp-resource-group.c | 32 +++++++++++++++++++-------------
1 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/libgssdp/gssdp-resource-group.c b/libgssdp/gssdp-resource-group.c
index a15c53f..11e05bc 100644
--- a/libgssdp/gssdp-resource-group.c
+++ b/libgssdp/gssdp-resource-group.c
@@ -1015,6 +1015,7 @@ resource_alive (Resource *resource)
GSSDPClient *client;
guint max_age;
char *al, *message;
+ int i;
/* Send initial byebye if not sent already */
send_initial_resource_byebye (resource);
@@ -1026,15 +1027,17 @@ resource_alive (Resource *resource)
al = construct_al (resource);
- message = g_strdup_printf (SSDP_ALIVE_MESSAGE,
- max_age,
- (char *) resource->locations->data,
- al ? al : "",
- gssdp_client_get_server_id (client),
- resource->target,
- resource->usn);
+ for (i = 0; i < 3; ++i) {
+ message = g_strdup_printf (SSDP_ALIVE_MESSAGE,
+ max_age,
+ (char *) resource->locations->data,
+ al ? al : "",
+ gssdp_client_get_server_id (client),
+ resource->target,
+ resource->usn);
- queue_message (resource->resource_group, message);
+ queue_message (resource->resource_group, message);
+ }
g_free (al);
}
@@ -1045,14 +1048,17 @@ resource_alive (Resource *resource)
static void
resource_byebye (Resource *resource)
{
+ int i;
char *message;
- /* Queue message */
- message = g_strdup_printf (SSDP_BYEBYE_MESSAGE,
- resource->target,
- resource->usn);
+ for (i = 0; i < 3; ++i) {
+ /* Queue message */
+ message = g_strdup_printf (SSDP_BYEBYE_MESSAGE,
+ resource->target,
+ resource->usn);
- queue_message (resource->resource_group, message);
+ queue_message (resource->resource_group, message);
+ }
}
/**
--
1.7.5.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]