changeset 16571:9fd54d123e22

lib-http: Remove request timeout from being used during payload read. The reading is done by the lib-http caller, which should have its own timeouts.
author Timo Sirainen <tss@iki.fi>
date Thu, 27 Jun 2013 20:32:01 +0300
parents eb63569f0f73
children 20a0595e6e5d
files src/lib-http/http-client-connection.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-http/http-client-connection.c	Thu Jun 27 20:28:51 2013 +0300
+++ b/src/lib-http/http-client-connection.c	Thu Jun 27 20:32:01 2013 +0300
@@ -269,8 +269,11 @@
 	if (conn->to_idle != NULL)
 		timeout_remove(&conn->to_idle);
 
-	if (conn->client->set.request_timeout_msecs > 0 &&
-	    conn->to_requests == NULL) {
+	if (conn->client->set.request_timeout_msecs == 0)
+		;
+	else if (conn->to_requests != NULL)
+		timeout_reset(conn->to_requests);
+	else {
 		conn->to_requests = timeout_add(conn->client->set.request_timeout_msecs,
 						http_client_connection_request_timeout, conn);
 	}
@@ -423,6 +426,10 @@
 		/* the callback may add its own I/O, so we need to remove
 		   our one before calling it */
 		io_remove(&conn->conn.io);
+		/* we've received the request itself, and we can't reset the
+		   timeout during the payload reading. */
+		if (conn->to_requests != NULL)
+			timeout_remove(&conn->to_requests);
 	}
 
 	http_client_connection_ref(conn);