From: Stephan Bosch Date: Fri, 29 Dec 2017 00:47:16 +0000 (+0100) Subject: lib-http: client: Base forcing shared context debug logging on the settings of the... X-Git-Tag: 2.3.1~174 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56c77bb544ea72a7322029329db0621e6990df55;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: Base forcing shared context debug logging on the settings of the context itself and each associated client. --- diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index 8b3ed5083d..a967126293 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -537,11 +537,30 @@ void http_client_context_unref(struct http_client_context **_cctx) pool_unref(&cctx->pool); } +static void +http_client_context_update_settings(struct http_client_context *cctx) +{ + struct http_client *client; + bool debug; + + /* revert back to context settings */ + debug = cctx->set.debug; + + /* merge with available client settings */ + for (client = cctx->clients_list; client != NULL; + client = client->next) { + debug = debug || client->set.debug; + } + + event_set_forced_debug(cctx->event, debug); +} + static void http_client_context_add_client(struct http_client_context *cctx, struct http_client *client) { DLLIST_PREPEND(&cctx->clients_list, client); + http_client_context_update_settings(cctx); } static void @@ -549,6 +568,7 @@ http_client_context_remove_client(struct http_client_context *cctx, struct http_client *client) { DLLIST_REMOVE(&cctx->clients_list, client); + http_client_context_update_settings(cctx); } void http_client_context_switch_ioloop(struct http_client_context *cctx)