mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Feature: Write correct history on initial attach of client
This commit is contained in:
parent
68ace66bd3
commit
7474fb8d8d
@ -936,9 +936,6 @@ static void __add_listener_to_source(source_t *source, client_t *client)
|
|||||||
{
|
{
|
||||||
size_t loop = 10;
|
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 {
|
do {
|
||||||
ICECAST_LOG_DEBUG("max on %s is %ld (cur %lu)", source->mount,
|
ICECAST_LOG_DEBUG("max on %s is %ld (cur %lu)", source->mount,
|
||||||
source->max_listeners, source->listeners);
|
source->max_listeners, source->listeners);
|
||||||
@ -1053,7 +1050,7 @@ static void _handle_get_request(client_t *client) {
|
|||||||
|
|
||||||
avl_tree_rlock(global.source_tree);
|
avl_tree_rlock(global.source_tree);
|
||||||
/* let's see if this is a source or just a random fserve file */
|
/* 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) {
|
if (source) {
|
||||||
/* true mount */
|
/* true mount */
|
||||||
do {
|
do {
|
||||||
|
17
src/source.c
17
src/source.c
@ -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
|
* check the fallback, and so on. Must have a global source lock to call
|
||||||
* this function.
|
* 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;
|
source_t *source = NULL;
|
||||||
ice_config_t *config;
|
ice_config_t *config;
|
||||||
@ -166,10 +166,20 @@ source_t *source_find_mount(const char *mount)
|
|||||||
{
|
{
|
||||||
source = source_find_mount_raw(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)
|
if (source->running || source->on_demand)
|
||||||
break;
|
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
|
/* 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;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int source_compare_sources(void *arg, void *a, void *b)
|
int source_compare_sources(void *arg, void *a, void *b)
|
||||||
{
|
{
|
||||||
source_t *srca = (source_t *)a;
|
source_t *srca = (source_t *)a;
|
||||||
|
@ -92,7 +92,8 @@ void *source_client_thread (void *arg);
|
|||||||
void source_client_callback (client_t *client, void *source);
|
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_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo);
|
||||||
void source_clear_source (source_t *source);
|
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);
|
source_t *source_find_mount_raw(const char *mount);
|
||||||
client_t *source_find_client(source_t *source, connection_id_t id);
|
client_t *source_find_client(source_t *source, connection_id_t id);
|
||||||
int source_compare_sources(void *arg, void *a, void *b);
|
int source_compare_sources(void *arg, void *a, void *b);
|
||||||
|
Loading…
Reference in New Issue
Block a user