dovecot-2.2: lib-imap-client: Fixed GMail [THROTTLED] detection.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Mar 9 13:43:01 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/c28d8e2ae6a9
changeset: 18311:c28d8e2ae6a9
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 09 15:32:23 2015 +0200
description:
lib-imap-client: Fixed GMail [THROTTLED] detection.
It's not a resp-text-code, but appended at the end of line.
diffstat:
src/lib-imap-client/imapc-connection.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diffs (39 lines):
diff -r 08aa1949227b -r c28d8e2ae6a9 src/lib-imap-client/imapc-connection.c
--- a/src/lib-imap-client/imapc-connection.c Mon Mar 09 15:26:45 2015 +0200
+++ b/src/lib-imap-client/imapc-connection.c Mon Mar 09 15:32:23 2015 +0200
@@ -634,15 +634,6 @@
conn->selecting_box = NULL;
}
}
- if (strcasecmp(key, "THROTTLED") == 0 && !conn->throttle_pending) {
- /* GMail throttling - start slowing down commands. */
- conn->throttle_end_timeval = ioloop_timeval;
- timeval_add_msecs(&conn->throttle_end_timeval,
- (1U << conn->throttle_counter) * 1000);
- conn->throttle_pending = TRUE;
- if (conn->throttle_counter < IMAPC_THROTTLE_COUNTER_MAX_EXP)
- conn->throttle_counter++;
- }
return 0;
}
@@ -1190,6 +1181,19 @@
reply.text_without_resp = reply.text_full;
}
if (!conn->throttle_pending &&
+ strstr(reply.text_full, "[THROTTLED]") != NULL) {
+ /* GMail throttling - start slowing down commands.
+ unfortunately this isn't a nice resp-text-code, but just
+ appended at the end of the line (although we kind of support
+ it as resp-text-code also in here if it's uppercased). */
+ conn->throttle_end_timeval = ioloop_timeval;
+ timeval_add_msecs(&conn->throttle_end_timeval,
+ (1U << conn->throttle_counter) * 1000);
+ conn->throttle_pending = TRUE;
+ if (conn->throttle_counter < IMAPC_THROTTLE_COUNTER_MAX_EXP)
+ conn->throttle_counter++;
+ }
+ if (!conn->throttle_pending &&
timeval_cmp(&ioloop_timeval, &conn->throttle_end_timeval) >= 0) {
/* tagged reply without [THROTTLED] and it was received after
the throttling ended. we can completely reset the throttling
More information about the dovecot-cvs
mailing list