1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

Update: Move from a next update time to a last update time structure

This commit is contained in:
Philipp Schafft 2022-03-30 09:08:13 +00:00
parent a1c2f04453
commit 9bc4d9fe4d
2 changed files with 5 additions and 4 deletions

View File

@ -289,7 +289,7 @@ void source_clear_source (source_t *source)
source->prev_listeners = 0;
source->hidden = 0;
source->shoutcast_compat = 0;
source->client_stats_update = 0;
source->last_stats_update = 0;
util_dict_free(source->audio_info);
source->audio_info = NULL;
@ -499,13 +499,14 @@ static refbuf_t *get_next_buffer (source_t *source)
source->last_read = current;
}
if (current >= source->client_stats_update) {
if (current >= (source->last_stats_update + 5)) {
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);
}
source->client_stats_update = current + 5;
source->last_stats_update = current;
}
if (fds < 0) {
if (!sock_recoverable(sock_error())) {

View File

@ -32,7 +32,7 @@ struct source_tag {
client_t *client;
connection_t *con;
http_parser_t *parser;
time_t client_stats_update;
time_t last_stats_update;
char *mount; // TODO: Should we at some point migrate away from this to only use identifier?
mount_identifier_t *identifier;