]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
ldap: Avoid kqueue/epoll errors when LDAP connection closes unexpectedly.
authorTimo Sirainen <tss@iki.fi>
Thu, 21 Aug 2008 04:36:40 +0000 (07:36 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 21 Aug 2008 04:36:40 +0000 (07:36 +0300)
--HG--
branch : HEAD

src/auth/db-ldap.c

index 34cbc4887b8146a549a22be3ada913db2ed124bd..e394ef0c584aa39b27d5cab35f865e0cc062d7e9 100644 (file)
@@ -851,15 +851,18 @@ static void db_ldap_conn_close(struct ldap_connection *conn)
                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)
                        timeout_remove(&conn->to);