]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Fix to previous commit.
authorTimo Sirainen <tss@iki.fi>
Wed, 23 Oct 2013 13:33:43 +0000 (16:33 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 23 Oct 2013 13:33:43 +0000 (16:33 +0300)
It broke doveadm-server's "does client need authentication?" check.

src/lib-master/master-service.c

index 264690e0fb3d0c0eaba3d509a0f801f0e818e4f8..c3666aa67fa0922ba5f58c2a24b7917823e42206 100644 (file)
@@ -638,15 +638,6 @@ void master_service_client_connection_created(struct master_service *service)
        i_assert(service->master_status.available_count > 0);
        service->master_status.available_count--;
        master_status_update(service);
-
-       if (service->master_status.available_count == 0 &&
-           service->service_count_left == 1) {
-               /* we're not going to accept any more connections after this.
-                  go ahead and close the connection early. */
-               i_assert(service->listeners != NULL);
-               master_service_io_listeners_remove(service);
-               master_service_io_listeners_close(service);
-       }
 }
 
 void master_service_client_connection_accept(struct master_service_connection *conn)
@@ -849,6 +840,16 @@ static void master_service_listen(struct master_service_listener *l)
                   as real clients */
                master_service_client_connection_destroyed(service);
        }
+       if (service->master_status.available_count == 0 &&
+           service->service_count_left == 1) {
+               /* we're not going to accept any more connections after this.
+                  go ahead and close the connection early. don't do this
+                  before calling callback, because it may want to access
+                  the listen_fd (e.g. to check socket permissions). */
+               i_assert(service->listeners != NULL);
+               master_service_io_listeners_remove(service);
+               master_service_io_listeners_close(service);
+       }
 }
 
 static void io_listeners_init(struct master_service *service)