From 39018a601747b9d52a15ce2451e64e9515587944 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 4 Dec 2017 12:58:47 +0200 Subject: [PATCH] lib-http: client: Remove redundant debug logging checks --- src/lib-http/http-client-connection.c | 11 ++++------- src/lib-http/http-client-host.c | 8 +++----- src/lib-http/http-client-peer.c | 9 +++------ src/lib-http/http-client-queue.c | 25 ++++++++++--------------- src/lib-http/http-client-request.c | 8 +++----- src/lib-http/http-client.c | 3 +-- 6 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/lib-http/http-client-connection.c b/src/lib-http/http-client-connection.c index 4fb30d0532..a0285689a5 100644 --- a/src/lib-http/http-client-connection.c +++ b/src/lib-http/http-client-connection.c @@ -32,11 +32,9 @@ http_client_connection_debug(struct http_client_connection *conn, { va_list args; - if (conn->debug || conn->ppool->peer->cctx->set.debug) { - va_start(args, format); - e_debug(conn->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); - } + va_start(args, format); + e_debug(conn->event, "%s", t_strdup_vprintf(format, args)); + va_end(args); } /* @@ -1400,8 +1398,7 @@ http_client_connection_ssl_init(struct http_client_connection *conn, ssl_set.verbose_invalid_cert = TRUE; } - if (set->debug) - http_client_connection_debug(conn, "Starting SSL handshake"); + http_client_connection_debug(conn, "Starting SSL handshake"); if (io_stream_create_ssl_client(ssl_ctx, pshared->addr.a.tcp.https_name, &ssl_set, diff --git a/src/lib-http/http-client-host.c b/src/lib-http/http-client-host.c index 4f7a8ab920..88d12f0497 100644 --- a/src/lib-http/http-client-host.c +++ b/src/lib-http/http-client-host.c @@ -56,11 +56,9 @@ http_client_host_debug(struct http_client_host *host, { va_list args; - if (host->client->set.debug) { - va_start(args, format); - e_debug(host->shared->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); - } + va_start(args, format); + e_debug(host->shared->event, "%s", t_strdup_vprintf(format, args)); + va_end(args); } /* diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index 5eda3c4701..63b854c85c 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -81,14 +81,11 @@ static inline void http_client_peer_debug(struct http_client_peer *peer, const char *format, ...) { - struct http_client *client = peer->client; va_list args; - if (client->set.debug) { - va_start(args, format); - e_debug(peer->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); - } + va_start(args, format); + e_debug(peer->event, "%s", t_strdup_vprintf(format, args)); + va_end(args); } /* diff --git a/src/lib-http/http-client-queue.c b/src/lib-http/http-client-queue.c index e8d2f265a4..99b146f536 100644 --- a/src/lib-http/http-client-queue.c +++ b/src/lib-http/http-client-queue.c @@ -42,13 +42,10 @@ http_client_queue_debug(struct http_client_queue *queue, { va_list args; - if (queue->client->set.debug) { - - // FIXME: find some other method of distinguishing clients - va_start(args, format); - e_debug(queue->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); - } + // FIXME: find some other method of distinguishing clients + va_start(args, format); + e_debug(queue->event, "%s", t_strdup_vprintf(format, args)); + va_end(args); } /* @@ -776,14 +773,12 @@ http_client_queue_set_request_timer(struct http_client_queue *queue, i_assert(time->tv_sec > 0); timeout_remove(&queue->to_request); - if (queue->client->set.debug) { - http_client_queue_debug(queue, - "Set request timeout to %s.%03lu (now: %s.%03lu)", - t_strflocaltime("%Y-%m-%d %H:%M:%S", time->tv_sec), - ((unsigned long)time->tv_usec)/1000, - t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_timeval.tv_sec), - ((unsigned long)ioloop_timeval.tv_usec)/1000); - } + http_client_queue_debug(queue, + "Set request timeout to %s.%03lu (now: %s.%03lu)", + t_strflocaltime("%Y-%m-%d %H:%M:%S", time->tv_sec), + ((unsigned long)time->tv_usec)/1000, + t_strflocaltime("%Y-%m-%d %H:%M:%S", ioloop_timeval.tv_sec), + ((unsigned long)ioloop_timeval.tv_usec)/1000); /* set timer */ queue->to_request = timeout_add_absolute diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index 46e354fcf0..b9692ecc27 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -44,11 +44,9 @@ http_client_request_debug(struct http_client_request *req, { va_list args; - if (req->client->set.debug) { - va_start(args, format); - e_debug(req->event, "%s", t_strdup_vprintf(format, args)); - va_end(args); - } + va_start(args, format); + e_debug(req->event, "%s", t_strdup_vprintf(format, args)); + va_end(args); } /* diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index b88dd7c341..6601503ef7 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -102,8 +102,7 @@ http_client_debug(struct http_client *client, va_list args; va_start(args, format); - if (client->set.debug) - e_debug(client->event, "%s", t_strdup_vprintf(format, args)); + e_debug(client->event, "%s", t_strdup_vprintf(format, args)); va_end(args); } -- 2.47.3