]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
anvil: Stop immediately when master asks, instead of waiting for clients to finish.
authorTimo Sirainen <tss@iki.fi>
Fri, 4 Sep 2009 21:34:18 +0000 (17:34 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 4 Sep 2009 21:34:18 +0000 (17:34 -0400)
--HG--
branch : HEAD

src/anvil/main.c
src/lib-master/master-service.c
src/login-common/sasl-server.c

index 18b991be006c69f73dd6dc624b52ba76c73d108c..06a6d1268e2ea1041ae07fe0a6949d74096a3293 100644 (file)
@@ -30,6 +30,7 @@ int main(int argc, char *argv[])
                        exit(FATAL_DEFAULT);
        }
 
+       master_service_set_die_with_master(master_service, TRUE);
        master_service_init_log(master_service, "anvil: ", 0);
        master_service_init_finish(master_service);
        connect_limit = connect_limit_init();
index 2d88ca0b13f8d00d92ed45d5d0550ee31b952b88..151934dac08a64a84017f575c8d873c52521f1b5 100644 (file)
@@ -416,9 +416,14 @@ void master_service_anvil_send(struct master_service *service, const char *cmd)
                return;
 
        ret = write(MASTER_ANVIL_FD, cmd, strlen(cmd));
-       if (ret < 0)
+       if (ret < 0) {
+               if (errno == EPIPE) {
+                       /* anvil process was probably recreated, don't bother
+                          logging an error about losing connection to it */
+                       return;
+               }
                i_error("write(anvil) failed: %m");
-       else if (ret == 0)
+       else if (ret == 0)
                i_error("write(anvil) failed: EOF");
        else {
                i_assert((size_t)ret == strlen(cmd));
index 0796b2eeea47caf309c4b61b07950f40d5938fe6..460ee6913c4c33472fcefb022c47de4dbe4c0a8b 100644 (file)
@@ -138,8 +138,14 @@ static bool anvil_has_too_many_connections(struct client *client)
        ident = t_strconcat("LOOKUP\t", net_ip2addr(&client->ip), "/",
                            str_tabescape(client->virtual_user), "/",
                            login_protocol, "\n", NULL);
-       if (write_full(anvil_fd, ident, strlen(ident)) < 0)
+       if (write_full(anvil_fd, ident, strlen(ident)) < 0) {
+               if (errno == EPIPE) {
+                       /* anvil process was probably recreated, don't bother
+                          logging an error about losing connection to it */
+                       return FALSE;
+               }
                i_fatal("write(anvil) failed: %m");
+       }
        ret = read(anvil_fd, buf, sizeof(buf)-1);
        if (ret < 0)
                i_fatal("read(anvil) failed: %m");