mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Allow for new listeners to fallback if there are max listeners on the
current mountpoint svn path=/icecast/trunk/icecast/; revision=9833
This commit is contained in:
parent
663bd804dc
commit
82e12b4d96
@ -98,6 +98,7 @@
|
||||
<burst-size>65536</burst-size>
|
||||
<fallback-mount>/example2.ogg</fallback-mount>
|
||||
<fallback-override>1</fallback-override>
|
||||
<fallback-when-full>1</fallback-when-full>
|
||||
<intro>/example_intro.ogg</intro>
|
||||
<hidden>1</hidden>
|
||||
<no-yp>1</no-yp>
|
||||
|
@ -369,6 +369,7 @@ If you are relaying a Shoutcast stream, you need to specify this indicator to al
|
||||
<intro>/intro.ogg</intro>
|
||||
<fallback-mount>/example2.ogg</fallback-mount>
|
||||
<fallback-override>1</fallback-override>
|
||||
<fallback-when-full>1</fallback-when-full>
|
||||
<public>1</public>
|
||||
<stream-name>My audio stream</stream-name>
|
||||
<stream-description>My audio description</stream-description>
|
||||
@ -455,6 +456,12 @@ This multi-level fallback allows clients to cascade several mountpoints.
|
||||
When enabled, this allows a connecting source client or relay on this mountpoint to move
|
||||
listening clients back from the fallback mount.
|
||||
</div>
|
||||
<h4>fallback-when-full</h4>
|
||||
<div class="indentedbox">
|
||||
<p>When set to 1, this will cause new listeners, when the max listener count for the
|
||||
mountpoint has been reached, to move to the fallback mount if there is one specified.
|
||||
</p>
|
||||
</div>
|
||||
<h4>no-yp (deprecated)</h4>
|
||||
<div class="indentedbox">
|
||||
<p>Setting this option prevents this mountpoint from advertising on YP. The default is 0
|
||||
|
@ -259,6 +259,7 @@ static int check_duplicate_logins (source_t *source, client_t *client)
|
||||
*/
|
||||
static int add_client_to_source (source_t *source, client_t *client)
|
||||
{
|
||||
int loop = 10;
|
||||
do
|
||||
{
|
||||
DEBUG3 ("max on %s is %ld (cur %lu)", source->mount,
|
||||
@ -268,6 +269,14 @@ static int add_client_to_source (source_t *source, client_t *client)
|
||||
if (source->listeners < (unsigned long)source->max_listeners)
|
||||
break;
|
||||
|
||||
if (loop && source->fallback_when_full && source->fallback_mount)
|
||||
{
|
||||
source_t *next = source_find_mount (source->fallback_mount);
|
||||
INFO1 ("stream full trying %s", next->mount);
|
||||
source = next;
|
||||
loop--;
|
||||
continue;
|
||||
}
|
||||
/* now we fail the client */
|
||||
return -1;
|
||||
|
||||
|
@ -569,6 +569,11 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
|
||||
mount->fallback_mount = (char *)xmlNodeListGetString(
|
||||
doc, node->xmlChildrenNode, 1);
|
||||
}
|
||||
else if (strcmp(node->name, "fallback-when-full") == 0) {
|
||||
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
mount->fallback_when_full = atoi(tmp);
|
||||
if(tmp) xmlFree(tmp);
|
||||
}
|
||||
else if (strcmp(node->name, "max-listeners") == 0) {
|
||||
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
mount->max_listeners = atoi(tmp);
|
||||
|
@ -49,6 +49,8 @@ typedef struct _mount_proxy {
|
||||
char *dumpfile; /* Filename to dump this stream to (will be appended). NULL
|
||||
to not dump. */
|
||||
char *intro_filename; /* Send contents of file to client before the stream */
|
||||
int fallback_when_full; /* switch new listener to fallback source
|
||||
when max listeners reached */
|
||||
int max_listeners; /* Max listeners for this mountpoint only. -1 to not
|
||||
limit here (i.e. only use the global limit) */
|
||||
char *fallback_mount; /* Fallback mountname */
|
||||
|
@ -1118,6 +1118,9 @@ static void source_apply_mount (source_t *source, mount_proxy *mountinfo)
|
||||
if (mountinfo && mountinfo->burst_size >= 0)
|
||||
source->burst_size = (unsigned int)mountinfo->burst_size;
|
||||
|
||||
if (mountinfo && mountinfo->fallback_when_full)
|
||||
source->fallback_when_full = mountinfo->fallback_when_full;
|
||||
|
||||
if (source->format && source->format->apply_settings)
|
||||
source->format->apply_settings (source->client, source->format, mountinfo);
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ typedef struct source_tag
|
||||
long max_listeners;
|
||||
int yp_public;
|
||||
int fallback_override;
|
||||
int fallback_when_full;
|
||||
int shoutcast_compat;
|
||||
|
||||
/* per source burst handling for connecting clients */
|
||||
|
Loading…
x
Reference in New Issue
Block a user