From 33ec853dbd937277c997c02741c4aad880f1909e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 2 Jul 2014 11:39:39 +0200 Subject: [PATCH] subscription: log also hostname/username/client --- src/subscriptions.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/subscriptions.c b/src/subscriptions.c index 80985199..44cd8a37 100644 --- a/src/subscriptions.c +++ b/src/subscriptions.c @@ -373,6 +373,8 @@ void subscription_unsubscribe(th_subscription_t *s) { service_t *t = s->ths_service; + char buf[512]; + size_t buflen; lock_assert(&global_lock); @@ -384,13 +386,22 @@ subscription_unsubscribe(th_subscription_t *s) if(s->ths_channel != NULL) { LIST_REMOVE(s, ths_channel_link); - tvhlog(LOG_INFO, "subscription", "\"%s\" unsubscribing from \"%s\"", - s->ths_title, channel_get_name(s->ths_channel)); + snprintf(buf, sizeof(buf), "\"%s\" unsubscribing from \"%s\"", + s->ths_title, channel_get_name(s->ths_channel)); } else { - tvhlog(LOG_INFO, "subscription", "\"%s\" unsubscribing", - s->ths_title); + snprintf(buf, sizeof(buf), "\"%s\" unsubscribing", s->ths_title); } + if (s->ths_hostname) { + buflen = strlen(buf); + snprintf(buf + buflen, sizeof(buf) - buflen, + ", hostname=\"%s\", username=\"%s\", client=\"%s\"", + s->ths_hostname ?: "", + s->ths_username ?: "", + s->ths_client ?: ""); + } + tvhlog(LOG_INFO, "subscription", buf); + if(t) service_remove_subscriber(t, s, SM_CODE_OK); @@ -511,13 +522,16 @@ subscription_create_from_channel_or_service tvhlog(LOG_INFO, "subscription", "\"%s\" subscribing on \"%s\", weight: %d, adapter: \"%s\", " "network: \"%s\", mux: \"%s\", provider: \"%s\", " - "service: \"%s\"", + "service: \"%s\", hostname: \"%s\", username: \"%s\", client: \"%s\"", s->ths_title, ch ? channel_get_name(ch) : "none", weight, si.si_adapter ?: "", si.si_network ?: "", si.si_mux ?: "", si.si_provider ?: "", - si.si_service ?: ""); + si.si_service ?: "", + hostname ?: "", + username ?: "", + client ?: ""); service_source_info_free(&si); } @@ -639,12 +653,16 @@ subscription_create_from_mux tvhinfo("subscription", "'%s' subscribing to mux, weight: %d, adapter: '%s', " - "network: '%s', mux: '%s'", + "network: '%s', mux: '%s', hostname: '%s', username: '%s', " + "client: '%s'", s->ths_title, s->ths_weight, ss->ss_si.si_adapter ?: "", ss->ss_si.si_network ?: "", - ss->ss_si.si_mux ?: ""); + ss->ss_si.si_mux ?: "", + hostname ?: "", + username ?: "", + client ?: ""); sm = streaming_msg_create_data(SMT_START, ss); streaming_target_deliver(s->ths_output, sm);