Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP Client: improve server detection - retrigger MSEARCH when a br…
…oadcast is received, too
  • Loading branch information
perexg committed May 6, 2015
1 parent 00d792a commit cafbf1a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/input/mpegts/satip/satip.c
Expand Up @@ -35,6 +35,8 @@
#include <sys/socket.h>
#endif

static void satip_discovery_timer_cb(void *aux);

/*
*
*/
Expand Down Expand Up @@ -976,13 +978,13 @@ satip_discovery_service_received
}
/* Sanity checks */
if (st == NULL || strcmp(st, "urn:ses-com:device:SatIPServer:1"))
return;
goto add_uuid;
if (uuid == NULL || strlen(uuid) < 16 || satip_server_match_uuid(uuid))
return;
goto add_uuid;
if (location == NULL || strncmp(location, "http://", 7))
return;
goto add_uuid;
if (bootid == NULL || configid == NULL || server == NULL)
return;
goto add_uuid;

/* Forward information to next layer */

Expand Down Expand Up @@ -1015,6 +1017,16 @@ satip_discovery_service_received
pthread_mutex_unlock(&global_lock);
if (i) /* duplicate */
satip_discovery_destroy(d, 0);
return;

add_uuid:
if (deviceid == NULL || uuid == NULL)
return;
/* if new uuid was discovered, retrigger MSEARCH */
pthread_mutex_lock(&global_lock);
if (!satip_device_find(uuid))
gtimer_arm(&satip_discovery_timer, satip_discovery_timer_cb, NULL, 5);
pthread_mutex_unlock(&global_lock);
}

static void
Expand Down

0 comments on commit cafbf1a

Please sign in to comment.