mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Feature: Consider sources aged (-> good) after 30 seconds
This commit is contained in:
parent
35415d93a8
commit
2076328683
@ -588,6 +588,7 @@ xmlDocPtr admin_build_sourcelist(const char *mount, client_t *client, admin_form
|
||||
admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_GOT_DATA, true, "no-got-data");
|
||||
admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_FORMAT_GENERIC, false, "format-generic");
|
||||
admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_LEGACY_METADATA, false, "legacy-metadata");
|
||||
admin_build_sourcelist__add_flag(maintenancenode, flags, SOURCE_FLAG_AGED, true, "no-aged");
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%"PRIu64, source->dumpfile_written);
|
||||
|
@ -502,12 +502,18 @@ static refbuf_t *get_next_buffer (source_t *source)
|
||||
}
|
||||
|
||||
if (current >= (source->last_stats_update + 5)) {
|
||||
time_t age = current - source->create_time;
|
||||
|
||||
stats_event_args(source->mount, "total_bytes_read", "%"PRIu64, source->format->read_bytes);
|
||||
stats_event_args(source->mount, "total_bytes_sent", "%"PRIu64, source->format->sent_bytes);
|
||||
if (source->dumpfile) {
|
||||
stats_event_args(source->mount, "dumpfile_written", "%"PRIu64, source->dumpfile_written);
|
||||
}
|
||||
|
||||
if (age > 30) { /* TODO: Should this be configurable? */
|
||||
source_set_flags(source, SOURCE_FLAG_AGED);
|
||||
}
|
||||
|
||||
source->last_stats_update = current;
|
||||
}
|
||||
if (fds < 0) {
|
||||
@ -1546,6 +1552,9 @@ health_t source_get_health_by_flags(source_flags_t flags)
|
||||
if (flags & SOURCE_FLAG_LEGACY_METADATA)
|
||||
health = health_atbest(health, HEALTH_ERROR);
|
||||
|
||||
if (!(flags & SOURCE_FLAG_AGED))
|
||||
health = health_atbest(health, HEALTH_WARNING);
|
||||
|
||||
return health;
|
||||
}
|
||||
|
||||
|
@ -33,9 +33,10 @@ typedef uint_least32_t source_flags_t;
|
||||
#define SOURCE_FLAG_GOT_DATA ((source_flags_t)0x00000001U)
|
||||
#define SOURCE_FLAG_FORMAT_GENERIC ((source_flags_t)0x00000002U)
|
||||
#define SOURCE_FLAG_LEGACY_METADATA ((source_flags_t)0x00000004U)
|
||||
#define SOURCE_FLAG_AGED ((source_flags_t)0x00000008U)
|
||||
|
||||
#define SOURCE_FLAGS_CLEARABLE (SOURCE_FLAG_LEGACY_METADATA)
|
||||
#define SOURCE_FLAGS_GOOD (SOURCE_FLAG_GOT_DATA)
|
||||
#define SOURCE_FLAGS_GOOD (SOURCE_FLAG_GOT_DATA|SOURCE_FLAG_AGED)
|
||||
|
||||
struct source_tag {
|
||||
mutex_t lock;
|
||||
|
Loading…
Reference in New Issue
Block a user