dovecot-2.2: lib-http: client queue: Start using new timeval_cmp...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 4 14:33:31 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/94ba0150905b
changeset: 17879:94ba0150905b
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Oct 04 17:31:38 2014 +0300
description:
lib-http: client queue: Start using new timeval_cmp_margin function for delay handling.

diffstat:

 src/lib-http/http-client-queue.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 312dd5c349f5 -r 94ba0150905b src/lib-http/http-client-queue.c
--- a/src/lib-http/http-client-queue.c	Sat Oct 04 17:31:38 2014 +0300
+++ b/src/lib-http/http-client-queue.c	Sat Oct 04 17:31:38 2014 +0300
@@ -16,6 +16,8 @@
 
 #include "http-client-private.h"
 
+#define TIMEOUT_CMP_MARGIN_USECS 2000
+
 /*
  * Logging
  */
@@ -412,7 +414,8 @@
 	finished = 0;
 	reqs = array_get(&queue->delayed_request_queue, &count);
 	for (i = 0; i < count; i++) {
-		if (timeval_cmp(&reqs[i]->release_time, &ioloop_timeval) > 0) {
+		if (timeval_cmp_margin(&reqs[i]->release_time,
+			&ioloop_timeval, TIMEOUT_CMP_MARGIN_USECS) > 0) {
 			break;
 		}
 
@@ -465,7 +468,8 @@
 	if (req->release_time.tv_sec > 0) {
 		io_loop_time_refresh();
 
-		if (timeval_cmp(&req->release_time, &ioloop_timeval) > 0) {
+		if (timeval_cmp_margin(&req->release_time,
+			&ioloop_timeval, TIMEOUT_CMP_MARGIN_USECS) > 0) {
 			(void)array_bsearch_insert_pos(&queue->delayed_request_queue,
 					&req, http_client_queue_delayed_cmp, &insert_idx);
 			array_insert(&queue->delayed_request_queue, insert_idx, &req, 1);


More information about the dovecot-cvs mailing list