]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Fixes to handling FIFO connections. Also expose the FIFOness to caller.
authorTimo Sirainen <tss@iki.fi>
Fri, 4 Sep 2009 17:45:33 +0000 (13:45 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 4 Sep 2009 17:45:33 +0000 (13:45 -0400)
--HG--
branch : HEAD

src/lib-master/master-service.c
src/lib-master/master-service.h

index 750b490e6e6d4a4c18203dd904f4bdb253d85fbc..3769b4c70ff9fd7a450ee7c5e25e19cd6909bc13 100644 (file)
@@ -499,13 +499,12 @@ static void master_service_listen(struct master_service_listener *l)
                }
                /* it's not a socket. probably a fifo. use the "listener"
                   as the connection fd and stop the listener. */
-               io_remove(&l->io);
-               conn.fd = dup(l->fd);
+               conn.fd = l->fd;
                conn.listen_fd = l->fd;
-               if (conn.fd == -1) {
-                       i_error("dup() failed: %m");
-                       return;
-               }
+               conn.fifo = TRUE;
+
+               io_remove(&l->io);
+               l->fd = -1;
        }
        conn.ssl = l->ssl;
        net_set_nonblock(conn.fd, TRUE);
@@ -547,7 +546,7 @@ static void io_listeners_add(struct master_service *service)
        for (i = 0; i < service->socket_count; i++) {
                struct master_service_listener *l = &service->listeners[i];
 
-               if (l->io == NULL) {
+               if (l->io == NULL && l->fd != -1) {
                        l->io = io_add(MASTER_LISTEN_FD_FIRST + i, IO_READ,
                                       master_service_listen, l);
                }
index 3ddc2e0dd223eec194c7c7ade76bccbb8bab4f3d..c66766d968f33b798e577554498b6cd4dd6e67a0 100644 (file)
@@ -23,7 +23,8 @@ struct master_service_connection {
        struct ip_addr remote_ip;
        unsigned int remote_port;
 
-       bool ssl;
+       unsigned int fifo:1;
+       unsigned int ssl:1;
 };
 
 typedef void