dovecot-1.2: ldap: Avoid kqueue/epoll errors when LDAP connectio...

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 21 07:36:50 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/06cb6f9d3054
changeset: 8101:06cb6f9d3054
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 21 07:36:40 2008 +0300
description:
ldap: Avoid kqueue/epoll errors when LDAP connection closes unexpectedly.

diffstat:

1 file changed, 6 insertions(+), 3 deletions(-)
src/auth/db-ldap.c |    9 ++++++---

diffs (24 lines):

diff -r 83aef3a6c0a3 -r 06cb6f9d3054 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Thu Aug 21 07:35:59 2008 +0300
+++ b/src/auth/db-ldap.c	Thu Aug 21 07:36:40 2008 +0300
@@ -851,14 +851,17 @@ static void db_ldap_conn_close(struct ld
 		conn->pending_count = 0;
 	}
 
-	if (conn->io != NULL)
-		io_remove(&conn->io);
-
 	if (conn->ld != NULL) {
 		ldap_unbind(conn->ld);
 		conn->ld = NULL;
 	}
 	conn->fd = -1;
+
+	if (conn->io != NULL) {
+		/* the fd may have already been closed before ldap_unbind(),
+		   so we'll have to use io_remove_closed(). */
+		io_remove_closed(&conn->io);
+	}
 
 	if (aqueue_count(conn->request_queue) == 0) {
 		if (conn->to != NULL)


More information about the dovecot-cvs mailing list