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

Feature: Added warning about legacy sources on dashboard

This commit is contained in:
Philipp Schafft 2022-02-25 12:53:33 +00:00
parent abfd3c51a3
commit 241c8f0895
4 changed files with 16 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdbool.h>
#include <time.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
@ -1493,6 +1494,7 @@ static void command_dashboard (client_t *client, source_t *source, adm
int has_sources;
int has_many_clients;
int has_too_many_clients;
bool has_legacy_sources;
resource = reportxml_node_new(REPORTXML_NODE_TYPE_RESOURCE, NULL, NULL, NULL);
@ -1517,6 +1519,7 @@ static void command_dashboard (client_t *client, source_t *source, adm
has_sources = global.sources > 0;
has_many_clients = global.clients > ((75 * config->client_limit) / 100);
has_too_many_clients = global.clients > ((90 * config->client_limit) / 100);
has_legacy_sources = global.sources_legacy > 0;
global_unlock();
reportxml_node_add_child(resource, node);
refobject_unref(node);
@ -1545,6 +1548,9 @@ static void command_dashboard (client_t *client, source_t *source, adm
if (!has_sources)
__reportxml_add_maintenance(reportnode, config->reportxml_db, "f68dd8a3-22b1-4118-aba6-b039f2c5b51e", "info", "Currently no sources are connected to this server.", NULL);
if (has_legacy_sources)
__reportxml_add_maintenance(reportnode, config->reportxml_db, "a3a51986-3bba-42b9-ad5c-d9ecc9967320", "warning", "Legacy sources are connected. See mount list for details.", NULL);
if (has_too_many_clients) {
__reportxml_add_maintenance(reportnode, config->reportxml_db, "08676614-50b4-4ea7-ba99-7c2ffcecf705", "warning", "More than 90% of the server's configured maximum clients are connected", NULL);
} else if (has_many_clients) {

View File

@ -30,6 +30,7 @@
# include <strings.h>
#endif
#include "global.h"
#include "refbuf.h"
#include "source.h"
#include "client.h"
@ -119,6 +120,9 @@ int format_mp3_get_plugin(source_t *source)
source->format = plugin;
thread_mutex_create(&state->url_lock);
/* we are in global locked state here, locked by connection_complete_source(). */
global.sources_legacy++;
return 0;
}
@ -488,6 +492,10 @@ static void format_mp3_free_plugin(format_plugin_t *self)
free(state);
vorbis_comment_clear(&self->vc);
free(self);
global_lock();
global.sources_legacy--;
global_unlock();
}

View File

@ -38,6 +38,7 @@ void global_initialize(void)
global.running = 0;
global.clients = 0;
global.sources = 0;
global.sources_legacy = 0;
global.source_tree = avl_tree_new(source_compare_sources, NULL);
global.modulecontainer = refobject_new(module_container_t);
thread_mutex_create(&_global_mutex);

View File

@ -32,6 +32,7 @@ typedef struct ice_global_tag
int running;
int sources;
int sources_legacy;
int clients;
int schedule_config_reread;