1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Feature: Write correct history on initial attach of client

This commit is contained in:
Philipp Schafft 2020-11-08 18:23:03 +00:00
parent 68ace66bd3
commit 7474fb8d8d
3 changed files with 16 additions and 9 deletions

View File

@ -936,9 +936,6 @@ static void __add_listener_to_source(source_t *source, client_t *client)
{
size_t loop = 10;
if (navigation_history_navigate_to(&(client->history), source->identifier, NAVIGATION_DIRECTION_REPLACE_ALL) != 0)
ICECAST_LOG_ERROR("Can not change history: navigation of client=%p{.con.id=%llu, ...} to source=%p{.mount=%#H, ...} failed", client, (unsigned long long int)client->con->id, source, source->mount);
do {
ICECAST_LOG_DEBUG("max on %s is %ld (cur %lu)", source->mount,
source->max_listeners, source->listeners);
@ -1053,7 +1050,7 @@ static void _handle_get_request(client_t *client) {
avl_tree_rlock(global.source_tree);
/* let's see if this is a source or just a random fserve file */
source = source_find_mount(client->uri);
source = source_find_mount_with_history(client->uri, &(client->history));
if (source) {
/* true mount */
do {

View File

@ -154,7 +154,7 @@ source_t *source_find_mount_raw(const char *mount)
* check the fallback, and so on. Must have a global source lock to call
* this function.
*/
source_t *source_find_mount(const char *mount)
source_t *source_find_mount_with_history(const char *mount, navigation_history_t *history)
{
source_t *source = NULL;
ice_config_t *config;
@ -166,10 +166,20 @@ source_t *source_find_mount(const char *mount)
{
source = source_find_mount_raw(mount);
if (source)
{
if (source) {
if (history)
navigation_history_navigate_to(history, source->identifier, NAVIGATION_DIRECTION_DOWN);
if (source->running || source->on_demand)
break;
} else {
if (history) {
mount_identifier_t *identifier = mount_identifier_new(mount);
if (identifier) {
navigation_history_navigate_to(history, identifier, NAVIGATION_DIRECTION_DOWN);
refobject_unref(identifier);
}
}
}
/* we either have a source which is not active (relay) or no source
@ -188,7 +198,6 @@ source_t *source_find_mount(const char *mount)
return source;
}
int source_compare_sources(void *arg, void *a, void *b)
{
source_t *srca = (source_t *)a;

View File

@ -92,7 +92,8 @@ void *source_client_thread (void *arg);
void source_client_callback (client_t *client, void *source);
void source_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo);
void source_clear_source (source_t *source);
source_t *source_find_mount(const char *mount);
#define source_find_mount(mount) source_find_mount_with_history((mount), NULL)
source_t *source_find_mount_with_history(const char *mount, navigation_history_t *history);
source_t *source_find_mount_raw(const char *mount);
client_t *source_find_client(source_t *source, connection_id_t id);
int source_compare_sources(void *arg, void *a, void *b);