dovecot: If we've been waiting auth server to respond for over 3...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Oct 27 20:03:36 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/f40f4e1a0a3c
changeset: 6625:f40f4e1a0a3c
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 27 20:03:31 2007 +0300
description:
If we've been waiting auth server to respond for over 30 seconds, send a "OK
Waiting.." message to client.
diffstat:
2 files changed, 13 insertions(+)
src/imap-login/client.c | 12 ++++++++++++
src/imap-login/client.h | 1 +
diffs (51 lines):
diff -r 91a003d00b4e -r f40f4e1a0a3c src/imap-login/client.c
--- a/src/imap-login/client.c Sat Oct 27 19:06:33 2007 +0300
+++ b/src/imap-login/client.c Sat Oct 27 20:03:31 2007 +0300
@@ -39,6 +39,10 @@
client hash, it's faster if we disconnect multiple clients. */
#define CLIENT_DESTROY_OLDEST_COUNT 16
+/* If we've been waiting auth server to respond for over this many seconds,
+ send a "waiting" message. */
+#define AUTH_WAITING_TIMEOUT 30
+
#if CLIENT_LOGIN_IDLE_TIMEOUT >= AUTH_REQUEST_TIMEOUT
# error client idle timeout must be smaller than authentication timeout
#endif
@@ -344,10 +348,12 @@ void client_input(struct imap_client *cl
if (!auth_client_is_connected(auth_client)) {
/* we're not yet connected to auth process -
don't allow any commands */
+ client->waiting_sent = TRUE;
client_send_line(client,
"* OK Waiting for authentication process to respond..");
client->input_blocked = TRUE;
} else {
+ client->waiting_sent = FALSE;
o_stream_cork(client->output);
while (client_handle_input(client)) ;
o_stream_uncork(client->output);
@@ -576,6 +582,12 @@ static void client_check_idle(struct ima
if (ioloop_time - client->last_input >= CLIENT_LOGIN_IDLE_TIMEOUT) {
client_send_line(client, "* BYE Disconnected for inactivity.");
client_destroy(client, "Disconnected: Inactivity");
+ } else if (!client->waiting_sent &&
+ ioloop_time - client->last_input > AUTH_WAITING_TIMEOUT &&
+ (client->common.authenticating || !client->greeting_sent)) {
+ client->waiting_sent = TRUE;
+ client_send_line(client,
+ "* OK Waiting for authentication process to respond..");
}
}
diff -r 91a003d00b4e -r f40f4e1a0a3c src/imap-login/client.h
--- a/src/imap-login/client.h Sat Oct 27 19:06:33 2007 +0300
+++ b/src/imap-login/client.h Sat Oct 27 20:03:31 2007 +0300
@@ -30,6 +30,7 @@ struct imap_client {
unsigned int input_blocked:1;
unsigned int destroyed:1;
unsigned int greeting_sent:1;
+ unsigned int waiting_sent:1;
};
void client_destroy(struct imap_client *client, const char *reason);
More information about the dovecot-cvs
mailing list