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

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


details:   http://hg.dovecot.org/dovecot-1.1/rev/155d4e597397
changeset: 7825:155d4e597397
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 0930aa699486 -r 155d4e597397 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