diff --git a/src/client.c b/src/client.c index daa3fefc..97649b8e 100644 --- a/src/client.c +++ b/src/client.c @@ -164,6 +164,7 @@ int client_create(client_t **c_ptr, connection_t *con, http_parser_t *parser) client->refbuf->len = 0; /* force reader code to ignore buffer contents */ client->pos = 0; client->write_to_client = format_generic_write_to_client; + navigation_history_init(&(client->history)); *c_ptr = client; avl_tree_wlock(global_client_list); @@ -344,6 +345,7 @@ void client_destroy(client_t *client) free(client->password); free(client->role); acl_release(client->acl); + navigation_history_clear(&(client->history)); free(client); } diff --git a/src/client.h b/src/client.h index c440a52c..0d01ecfc 100644 --- a/src/client.h +++ b/src/client.h @@ -23,6 +23,7 @@ #include "common/httpp/encoding.h" #include "icecasttypes.h" +#include "navigation.h" #include "errors.h" #include "refbuf.h" #include "module.h" @@ -114,6 +115,9 @@ struct _client_tag { module_t *handler_module; char *handler_function; + /* History of navigated mount points */ + navigation_history_t history; + /* is client getting intro data */ long intro_offset; diff --git a/src/connection.c b/src/connection.c index 373e5cd1..807ce3dd 100644 --- a/src/connection.c +++ b/src/connection.c @@ -61,6 +61,7 @@ #include "refobject.h" #include "listensocket.h" #include "fastevent.h" +#include "navigation.h" #define CATMODULE "connection" @@ -966,6 +967,9 @@ static void __add_listener_to_source(source_t *source, client_t *client) client->refbuf->len = PER_CLIENT_REFBUF_SIZE; memset(client->refbuf->data, 0, PER_CLIENT_REFBUF_SIZE); + 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); + /* lets add the client to the active list */ avl_tree_wlock(source->pending_tree); avl_insert(source->pending_tree, client);