changeset 13490:c056bd23fdcc

lib-sql: If MySQL connect fails, update ioloop times so later timeouts get added properly.
author Timo Sirainen <tss@iki.fi>
date Thu, 15 Sep 2011 13:41:03 +0300
parents 3334c12a2b1a
children 11273f581686
files src/lib-sql/driver-mysql.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-sql/driver-mysql.c	Thu Sep 15 13:38:54 2011 +0300
+++ b/src/lib-sql/driver-mysql.c	Thu Sep 15 13:41:03 2011 +0300
@@ -1,6 +1,7 @@
 /* Copyright (c) 2003-2011 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "array.h"
 #include "str.h"
 #include "sql-api-private.h"
@@ -109,6 +110,11 @@
 				    client_flags) == NULL;
 	alarm(0);
 	if (failed) {
+		/* connecting could have taken a while. make sure that any
+		   timeouts that get added soon will get a refreshed
+		   timestamp. */
+		io_loop_time_refresh();
+
 		sql_db_set_state(&db->api, SQL_DB_STATE_DISCONNECTED);
 		i_error("%s: Connect failed to database (%s): %s - "
 			"waiting for %u seconds before retry",