dovecot-2.0: lib-master: Changed post-login process's client cou...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 7 04:20:58 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/64bead0067b0
changeset: 11102:64bead0067b0
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 07 04:20:55 2010 +0300
description:
lib-master: Changed post-login process's client counting to make sense again.
This should also fix problems where a new process isn't created because an
existing one is waiting for auth request reply.
diffstat:
src/lib-master/master-login.c | 25 +++++++------------------
src/lib-master/master-service-private.h | 1 -
src/lib-master/master-service.c | 14 +++++---------
3 files changed, 12 insertions(+), 28 deletions(-)
diffs (131 lines):
diff -r 7649c491b744 -r 64bead0067b0 src/lib-master/master-login.c
--- a/src/lib-master/master-login.c Wed Apr 07 04:19:24 2010 +0300
+++ b/src/lib-master/master-login.c Wed Apr 07 04:20:55 2010 +0300
@@ -28,6 +28,8 @@
int fd;
struct io *io;
struct ostream *output;
+
+ unsigned int login_success:1;
};
struct master_login_postlogin {
@@ -187,6 +189,7 @@
close_sockets = service->master_status.available_count == 0 &&
service->service_count_left == 1;
+ client->conn->login_success = TRUE;
login->callback(client, auth_args[0], auth_args+1);
if (close_sockets) {
@@ -250,7 +253,6 @@
}
master_login_client_free(&pl->client);
master_login_postlogin_free(pl);
- master_service_client_connection_destroyed(login->service);
return;
}
@@ -271,7 +273,6 @@
master_login_client_free(&pl->client);
master_login_postlogin_free(pl);
- master_service_client_connection_destroyed(login->service);
}
static int master_login_postlogin(struct master_login_client *client,
@@ -329,7 +330,6 @@
{
struct master_login_client *client = context;
struct master_auth_reply reply;
- struct master_service *service = client->conn->login->service;
memset(&reply, 0, sizeof(reply));
reply.tag = client->auth_req.tag;
@@ -348,18 +348,12 @@
return;
}
- i_assert(service->master_status.available_count > 0);
- service->master_status.available_count--;
- master_status_update(service);
-
if (client->conn->login->postlogin_socket_path == NULL)
master_login_auth_finish(client, auth_args);
else {
/* execute post-login scripts before finishing auth */
- if (master_login_postlogin(client, auth_args) < 0) {
+ if (master_login_postlogin(client, auth_args) < 0)
master_login_client_free(&client);
- master_service_client_connection_destroyed(service);
- }
}
}
@@ -410,12 +404,7 @@
DLLIST_PREPEND(&login->conns, conn);
- /* FIXME: currently there's a separate connection for each request.
- and currently we don't try to accept more connections until this
- request's authentication is finished, because updating
- available_count gets tricky. */
- login->service->login_authenticating = TRUE;
- master_service_io_listeners_remove(login->service);
+ /* NOTE: currently there's a separate connection for each request. */
}
static void master_login_conn_close(struct master_login_connection *conn)
@@ -434,8 +423,8 @@
i_error("close(master login) failed: %m");
conn->fd = -1;
- conn->login->service->login_authenticating = FALSE;
- master_service_io_listeners_add(conn->login->service);
+ if (!conn->login_success)
+ master_service_client_connection_destroyed(conn->login->service);
}
static void master_login_conn_unref(struct master_login_connection **_conn)
diff -r 7649c491b744 -r 64bead0067b0 src/lib-master/master-service-private.h
--- a/src/lib-master/master-service-private.h Wed Apr 07 04:19:24 2010 +0300
+++ b/src/lib-master/master-service-private.h Wed Apr 07 04:20:55 2010 +0300
@@ -61,7 +61,6 @@
unsigned int call_avail_overflow:1;
unsigned int delay_status_updates:1;
unsigned int config_path_is_default:1;
- unsigned int login_authenticating:1;
};
void master_service_io_listeners_add(struct master_service *service);
diff -r 7649c491b744 -r 64bead0067b0 src/lib-master/master-service.c
--- a/src/lib-master/master-service.c Wed Apr 07 04:19:24 2010 +0300
+++ b/src/lib-master/master-service.c Wed Apr 07 04:20:55 2010 +0300
@@ -706,14 +706,10 @@
conn.ssl = l->ssl;
net_set_nonblock(conn.fd, TRUE);
- if (service->login != NULL) {
- /* incoming connections are going to master-login and they're
- not counted as real connections */
- } else {
- i_assert(service->master_status.available_count > 0);
- service->master_status.available_count--;
- master_status_update(service);
- }
+ i_assert(service->master_status.available_count > 0);
+ service->master_status.available_count--;
+ master_status_update(service);
+
service->callback(&conn);
}
@@ -742,7 +738,7 @@
{
unsigned int i;
- if (service->stopping || service->login_authenticating)
+ if (service->stopping)
return;
if (service->listeners == NULL)
More information about the dovecot-cvs
mailing list