]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
net_* functions don't anymore set sockets to non-blocking by default.
authorTimo Sirainen <tss@iki.fi>
Tue, 4 Mar 2003 02:18:09 +0000 (04:18 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 4 Mar 2003 02:18:09 +0000 (04:18 +0200)
--HG--
branch : HEAD

src/auth/main.c
src/lib/network.c
src/login-common/auth-connection.c
src/login-common/ssl-proxy-gnutls.c
src/login-common/ssl-proxy-openssl.c
src/master/auth-process.c
src/master/main.c

index 9f2dca979acbb9ad208862f41014bf9c37d215ce..e419f5366b64c19b187eeebf787067abc635fd92 100644 (file)
@@ -35,6 +35,7 @@ static void auth_accept(void *context __attr_unused__)
                if (fd < -1)
                        i_fatal("accept() failed: %m");
        } else {
+               net_set_nonblock(fd, TRUE);
                (void)login_connection_create(fd);
        }
 }
index cb04b59a4c4423e0fef5abc0f5f37c15eb9047e7..875df3b86bbd53fdb73da9f8dcdc50554a0a782e 100644 (file)
@@ -147,7 +147,6 @@ int net_connect_ip(const struct ip_addr *ip, unsigned int port,
                return -1;
 
        /* set socket options */
-        net_set_nonblock(fd, TRUE);
        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
        setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
 
@@ -197,9 +196,6 @@ int net_connect_unix(const char *path)
        if (fd == -1)
                return -1;
 
-       /* set socket options */
-        net_set_nonblock(fd, TRUE);
-
        /* connect */
        ret = connect(fd, (struct sockaddr *) &sa, sizeof(sa));
        if (ret < 0 && errno != EINPROGRESS) {
@@ -283,7 +279,6 @@ int net_listen(const struct ip_addr *my_ip, unsigned int *port)
                return -1;
 
        /* set socket options */
-        net_set_nonblock(fd, TRUE);
        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
        setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
 
@@ -326,9 +321,6 @@ int net_listen_unix(const char *path)
        if (fd == -1)
                return -1;
 
-       /* set socket options */
-        net_set_nonblock(fd, TRUE);
-
        /* bind */
        if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) == 0) {
                /* start listening */
@@ -363,7 +355,6 @@ int net_accept(int fd, struct ip_addr *addr, unsigned int *port)
        if (addr != NULL) sin_get_ip(&so, addr);
        if (port != NULL) *port = sin_get_port(&so);
 
-        net_set_nonblock(ret, TRUE);
        return ret;
 }
 
index 3cb423d9206d7c83f6143b9a59add7950d604cee..2cf42caa20b92c67be7cd138edd734fd137eca1f 100644 (file)
@@ -58,8 +58,8 @@ static struct auth_connection *auth_connection_new(const char *path)
                return NULL;
        }
 
-       /* we depend on auth process - if it's slow, just wait */
-        net_set_nonblock(fd, FALSE);
+       /* use blocking connection since we depend on auth process -
+          if it's slow, just wait */
 
        conn = i_new(struct auth_connection, 1);
        conn->refcount = 1;
index 5346ad117d89f54eb757f5df5796dbd9e2b22abc..50b70bafb02eefad3b78213e1a3bb71c51e922df 100644 (file)
@@ -324,6 +324,7 @@ int ssl_proxy_new(int fd, struct ip_addr *ip)
 
        net_set_nonblock(sfd[0], TRUE);
        net_set_nonblock(sfd[1], TRUE);
+       net_set_nonblock(fd, TRUE);
 
        proxy = i_new(struct ssl_proxy, 1);
        proxy->refcount = 1;
index 59c6a4b7cc15a8aa183b0b3b8c3c48024957ea43..7a2935373e2d8f587a1738921f577e94897ff45d 100644 (file)
@@ -320,6 +320,7 @@ int ssl_proxy_new(int fd, struct ip_addr *ip)
 
        net_set_nonblock(sfd[0], TRUE);
        net_set_nonblock(sfd[1], TRUE);
+       net_set_nonblock(fd, TRUE);
 
        proxy = i_new(struct ssl_proxy, 1);
        proxy->refcount = 1;
index 4783009e2baaa4c2a2ffe6b241c323e851f97029..3d46bf98a07ba2efb01e497a47b3074643e907c5 100644 (file)
@@ -371,6 +371,7 @@ static void auth_process_group_create(struct auth_settings *auth_set)
        group->listen_fd = net_listen_unix(path);
        if (group->listen_fd < 0)
                i_fatal("Can't listen in UNIX socket %s: %m", path);
+       net_set_nonblock(group->listen_fd, TRUE);
        fd_close_on_exec(group->listen_fd, TRUE);
 
        /* set correct permissions */
index 19a8cfe7061ed984be05ea602a20c5a2b491a5e9..712a89bad04e757b59f4d43cda3d836cbe79dc69 100644 (file)
@@ -274,6 +274,7 @@ static void open_fds(void)
                *fd = port == 0 ? dup(null_fd) : net_listen(ip, &port);
                if (*fd == -1)
                        i_fatal("listen(%d) failed: %m", port);
+               net_set_nonblock(*fd, TRUE);
                fd_close_on_exec(*fd, TRUE);
        }