1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-16 06:15:24 +00:00

Feature: Added mount history to client and attach the client on initial attach

This commit is contained in:
Philipp Schafft 2020-10-24 11:25:42 +00:00
parent af35bd10d0
commit 5c504ec3dd
3 changed files with 10 additions and 0 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);