fix regression test

This commit is contained in:
Michal Hlavinka 2017-04-11 12:55:08 +02:00
parent 627140a00c
commit 8be51b99fe
2 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,76 @@
From 3a1c64363a64cdfe9153eb6292d8923f38955d82 Mon Sep 17 00:00:00 2001
From: Timo Sirainen <timo.sirainen@dovecot.fi>
Date: Mon, 10 Apr 2017 17:07:28 +0300
Subject: [PATCH] lib-imap-client: Fix reconnection
There was already code for reconnection. We just shouldn't have gone very
far in imapc_connection_connect() if we were still waiting for reconnection
delay to pass.
---
src/lib-imap-client/imapc-connection.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/src/lib-imap-client/imapc-connection.c b/src/lib-imap-client/imapc-connection.c
index 95067e6..6eaf1ab 100644
--- a/src/lib-imap-client/imapc-connection.c
+++ b/src/lib-imap-client/imapc-connection.c
@@ -130,6 +130,7 @@ struct imapc_connection {
struct timeout *to_throttle, *to_throttle_shrink;
unsigned int reconnecting:1;
+ unsigned int reconnect_waiting:1;
unsigned int reconnect_ok:1;
unsigned int idling:1;
unsigned int idle_stopping:1;
@@ -504,6 +505,7 @@ static bool imapc_connection_can_reconnect(struct imapc_connection *conn)
static void imapc_connection_reconnect(struct imapc_connection *conn)
{
conn->reconnect_ok = FALSE;
+ conn->reconnect_waiting = FALSE;
if (conn->selected_box != NULL)
imapc_client_mailbox_reconnect(conn->selected_box);
@@ -536,6 +538,7 @@ imapc_connection_try_reconnect(struct imapc_connection *conn,
imapc_connection_disconnect_full(conn, TRUE);
conn->to = timeout_add(delay_msecs, imapc_connection_reconnect, conn);
conn->reconnect_count++;
+ conn->reconnect_waiting = TRUE;
}
}
}
@@ -1785,6 +1788,12 @@ void imapc_connection_connect(struct imapc_connection *conn)
if (conn->fd != -1 || conn->dns_lookup != NULL)
return;
+ if (conn->reconnect_waiting) {
+ /* wait for the reconnection delay to finish before
+ doing anything. */
+ return;
+ }
+
conn->reconnecting = FALSE;
/* if we get disconnected before we've finished all the pending
commands, don't reconnect */
@@ -1792,22 +1801,6 @@ void imapc_connection_connect(struct imapc_connection *conn)
array_count(&conn->cmd_send_queue);
imapc_connection_input_reset(conn);
-
- int msecs_since_last_connect =
- timeval_diff_msecs(&ioloop_timeval, &conn->last_connect);
- if (!conn->reconnect_ok &&
- msecs_since_last_connect < (int)conn->client->set.connect_retry_interval_msecs) {
- if (conn->to != NULL)
- timeout_remove(&conn->to);
- conn->reconnecting = TRUE;
- imapc_connection_set_disconnected(conn);
- /* don't wait longer than necessary */
- unsigned int delay_msecs =
- conn->client->set.connect_retry_interval_msecs -
- msecs_since_last_connect;
- conn->to = timeout_add(delay_msecs, imapc_connection_reconnect, conn);
- return;
- }
conn->last_connect = ioloop_timeval;
if (conn->client->set.debug) {

View File

@ -33,6 +33,7 @@ Patch7: dovecot-2.2.13-online.patch
Patch8: dovecot-2.2.20-initbysystemd.patch
Patch9: dovecot-2.2.22-systemd_w_protectsystem.patch
Patch10: dovecot-2.2.29-3a1c64363a64cdfe9153eb6292d8923f38955d82.patch
Source15: prestartscript
@ -129,6 +130,7 @@ This package provides the development files for dovecot.
%patch7 -p1 -b .online
%patch8 -p1 -b .initbysystemd
%patch9 -p1 -b .systemd_w_protectsystem
%patch10 -p1 -b .3a1c64363a64cdfe9153eb6292d8923f38955d82
#pushd dovecot-2*2-pigeonhole-%{pigeonholever}
#popd
@ -406,9 +408,10 @@ make check
%{_libdir}/dovecot/doveadm
%exclude %{_libdir}/dovecot/doveadm/*sieve*
%{_libdir}/dovecot/*.so.*
#these (*.so files) are plugins, not a devel files
#these (*.so files) are plugins, not devel files
%{_libdir}/dovecot/*_plugin.so
%exclude %{_libdir}/dovecot/*_sieve_plugin.so
%{_libdir}/dovecot/auth/lib20_auth_var_expand_crypt.so
%{_libdir}/dovecot/auth/libauthdb_imap.so
%{_libdir}/dovecot/auth/libauthdb_ldap.so
%{_libdir}/dovecot/auth/libmech_gssapi.so
@ -423,6 +426,8 @@ make check
%{_libdir}/dovecot/libfs_crypt.so
%{_libdir}/dovecot/libfs_mail_crypt.so
%{_libdir}/dovecot/libdcrypt_openssl.so
%{_libdir}/dovecot/lib20_var_expand_crypt.so
%dir %{_libdir}/dovecot/settings
%{_libexecdir}/%{name}