mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Added config option for history size.
This adds a <max-history> config option to the <mount> section. Default is a history size of 4. See: #766
This commit is contained in:
parent
06fe442c2d
commit
961453b0de
@ -1263,6 +1263,7 @@ static void _parse_mount(xmlDocPtr doc,
|
||||
mount->burst_size = -1;
|
||||
mount->mp3_meta_interval = -1;
|
||||
mount->yp_public = -1;
|
||||
mount->max_history = -1;
|
||||
mount->next = NULL;
|
||||
|
||||
tmp = (char *)xmlGetProp(node, XMLSTR("type"));
|
||||
@ -1315,6 +1316,13 @@ static void _parse_mount(xmlDocPtr doc,
|
||||
mount->max_listeners = atoi(tmp);
|
||||
if(tmp)
|
||||
xmlFree(tmp);
|
||||
} else if (xmlStrcmp(node->name, XMLSTR("max-history")) == 0) {
|
||||
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
mount->max_history = atoi(tmp);
|
||||
if (mount->max_history < 1 || mount->max_history > 256)
|
||||
mount->max_history = 256; /* deny super huge values */
|
||||
if(tmp)
|
||||
xmlFree(tmp);
|
||||
} else if (xmlStrcmp(node->name, XMLSTR("charset")) == 0) {
|
||||
mount->charset = (char *)xmlNodeListGetString(doc,
|
||||
node->xmlChildrenNode, 1);
|
||||
@ -2240,6 +2248,8 @@ static void merge_mounts(mount_proxy * dst, mount_proxy * src)
|
||||
dst->subtype = (char*)xmlStrdup((xmlChar*)src->subtype);
|
||||
if (dst->yp_public == -1)
|
||||
dst->yp_public = src->yp_public;
|
||||
if (dst->max_history == -1)
|
||||
dst->max_history = src->max_history;
|
||||
|
||||
if (dst->http_headers) {
|
||||
http_header_next = dst->http_headers;
|
||||
|
@ -134,6 +134,9 @@ typedef struct _mount_proxy {
|
||||
/* additional HTTP headers */
|
||||
ice_config_http_header_t *http_headers;
|
||||
|
||||
/* maximum history size of played songs */
|
||||
ssize_t max_history;
|
||||
|
||||
struct event_registration_tag *event;
|
||||
|
||||
char *cluster_password;
|
||||
|
@ -100,7 +100,7 @@ source_t *source_reserve (const char *mount)
|
||||
|
||||
src->client_tree = avl_tree_new(_compare_clients, NULL);
|
||||
src->pending_tree = avl_tree_new(_compare_clients, NULL);
|
||||
src->history = playlist_new(-1);
|
||||
src->history = playlist_new(4 /* DOCUMENT: default is max_tracks=4. */);
|
||||
|
||||
/* make duplicates for strings or similar */
|
||||
src->mount = strdup(mount);
|
||||
@ -1216,6 +1216,9 @@ static void source_apply_mount (ice_config_t *config, source_t *source, mount_pr
|
||||
if (mountinfo && mountinfo->fallback_when_full)
|
||||
source->fallback_when_full = mountinfo->fallback_when_full;
|
||||
|
||||
if (mountinfo && mountinfo->max_history > 0)
|
||||
playlist_set_max_tracks(source->history, mountinfo->max_history);
|
||||
|
||||
avl_tree_unlock(source->client_tree);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user