]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Add http_client_request_stats.first_sent_msecs
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Apr 2017 09:59:08 +0000 (12:59 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Apr 2017 10:29:51 +0000 (13:29 +0300)
Also rename sent_msecs to last_sent_msecs.

src/lib-http/http-client-request.c
src/lib-http/http-client.h

index 99a0d5619ce52d3ae76f9163248a16b2896eba14..9e927637f1ca76d81398f126d55056c433cc92d6 100644 (file)
@@ -597,10 +597,16 @@ void http_client_request_get_stats(struct http_client_request *req,
        diff_msecs = timeval_diff_msecs(&ioloop_timeval, &req->submit_time);
        stats_r->total_msecs = (unsigned int)I_MAX(diff_msecs, 0);
 
+       /* elapsed time since message was first sent */
+       if (req->first_sent_time.tv_sec > 0) {
+               diff_msecs = timeval_diff_msecs(&ioloop_timeval, &req->first_sent_time);
+               stats_r->first_sent_msecs = (unsigned int)I_MAX(diff_msecs, 0);
+       }
+
        /* elapsed time since message was last sent */
        if (req->sent_time.tv_sec > 0) {
                diff_msecs = timeval_diff_msecs(&ioloop_timeval, &req->sent_time);
-               stats_r->sent_msecs = (unsigned int)I_MAX(diff_msecs, 0);
+               stats_r->last_sent_msecs = (unsigned int)I_MAX(diff_msecs, 0);
        }
 
        if (req->conn != NULL) {
@@ -644,9 +650,9 @@ void http_client_request_append_stats_text(struct http_client_request *req,
 
        http_client_request_get_stats(req, &stats);
 
-       if (stats.sent_msecs > 0) {
+       if (stats.last_sent_msecs > 0) {
                str_printfa(str, "sent %u.%03u secs ago",
-                           stats.sent_msecs/1000, stats.sent_msecs%1000);
+                           stats.last_sent_msecs/1000, stats.last_sent_msecs%1000);
        } else {
                str_append(str, "not yet sent");
        }
index 0a04b3441c19f68424530f7dd75e75af785d58c6..8b46831fa8004e79b5b34c0044f820f8bf906342 100644 (file)
@@ -186,8 +186,10 @@ struct http_client_tunnel {
 struct http_client_request_stats {
        /* Total elapsed time since message was submitted */
        unsigned int total_msecs;
+       /* Elapsed time since message was first sent */
+       unsigned int first_sent_msecs;
        /* Elapsed time since message was last sent */
-       unsigned int sent_msecs;
+       unsigned int last_sent_msecs;
 
        /* Time spent in other ioloops */
        unsigned int other_ioloop_msecs;