[gssdp] Send alive/byebye announcements three times
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp] Send alive/byebye announcements three times
- Date: Tue, 14 Jun 2011 19:27:35 +0000 (UTC)
commit cf13481a256d63421d1ffa88a4f4d418696eb94c
Author: Jens Georg <mail jensge org>
Date: Tue Jun 14 08:57:54 2011 +0200
Send alive/byebye announcements three times
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..39a142e 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;
+ guint8 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)
{
+ guint8 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);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]