Commit c519afa8 authored by Karl Heyes's avatar Karl Heyes

add per-mount listener time limit setting

svn path=/icecast/trunk/icecast/; revision=9834
parent 82e12b4d
......@@ -365,6 +365,7 @@ If you are relaying a Shoutcast stream, you need to specify this indicator to al
<username>othersource</username>
<password>hackmemore</password>
<max-listeners>1</max-listeners>
<max-listener-duration>3600</max-listener-duration>
<dump-file>/tmp/dump-example1.ogg</dump-file>
<intro>/intro.ogg</intro>
<fallback-mount>/example2.ogg</fallback-mount>
......@@ -416,6 +417,11 @@ An optional value which will set the password that a source must use to connect
<div class="indentedbox">
An optional value which will set the maximum number of listeners that can be attached to this mountpoint.
</div>
<h4>max-listener-duration</h4>
<div class="indentedbox">
An optional value which will set the length of time a listener will stay connected to the
stream. An auth component may override this.
</div>
<h4>dump-file</h4>
<div class="indentedbox">
An optional value which will set the filename which will be a dump of the stream coming through on this mountpoint.
......
......@@ -322,6 +322,10 @@ static int add_authenticated_client (const char *mount, mount_proxy *mountinfo,
avl_tree_unlock (global.source_tree);
return -1;
}
/* set a per-mount disconnect time if auth hasn't set one already */
if (mountinfo->max_listener_duration && client->con->discon_time == 0)
client->con->discon_time = time(NULL) + mountinfo->max_listener_duration;
ret = add_client_to_source (source, client);
avl_tree_unlock (global.source_tree);
if (ret == 0)
......
......@@ -615,6 +615,11 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
mount->on_disconnect = (char *)xmlNodeListGetString(
doc, node->xmlChildrenNode, 1);
}
else if (strcmp(node->name, "max-listener-duration") == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->max_listener_duration = atoi(tmp);
if(tmp) xmlFree(tmp);
}
else if (strcmp(node->name, "queue-size") == 0) {
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
mount->queue_size_limit = atoi (tmp);
......
......@@ -72,6 +72,7 @@ typedef struct _mount_proxy {
config_options_t *auth_options; /* Options for this type */
char *on_connect;
char *on_disconnect;
unsigned int max_listener_duration;
char *stream_name;
char *stream_description;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment