]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: connection: replace direct I/O callbacks with the connection callback
authorWilly Tarreau <wtarreau@exceliance.fr>
Fri, 6 Jul 2012 12:29:45 +0000 (14:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 2 Sep 2012 19:51:28 +0000 (21:51 +0200)
Almost all direct I/O callbacks have been changed to use the connection
callback instead. Only the TCP connection validation remains.

src/proto_tcp.c
src/session.c

index 5c04fb4b79bce9ef3423d69a9d86ff43b537b4f3..7b69aadc4093b21c4f41fc6c9a888eb5aab72c0c 100644 (file)
@@ -40,6 +40,7 @@
 #include <proto/acl.h>
 #include <proto/arg.h>
 #include <proto/buffers.h>
+#include <proto/connection.h>
 #include <proto/frontend.h>
 #include <proto/log.h>
 #include <proto/port_range.h>
@@ -476,14 +477,13 @@ int tcp_connect_server(struct stream_interface *si)
        if ((si->ob->flags & BF_OUT_EMPTY) || si->send_proxy_ofs) {
                fdtab[fd].cb[DIR_RD].f = tcp_connect_read;
                fdtab[fd].cb[DIR_WR].f = tcp_connect_write;
-               fdtab[fd].iocb = NULL;
        }
        else {
-               fdtab[fd].cb[DIR_RD].f = si_data(si)->read;
-               fdtab[fd].cb[DIR_WR].f = si_data(si)->write;
-               fdtab[fd].iocb = NULL;
+               fdtab[fd].cb[DIR_RD].f = NULL;
+               fdtab[fd].cb[DIR_WR].f = NULL;
        }
 
+       fdtab[fd].iocb = conn_fd_handler;
        fd_insert(fd);
        EV_FD_SET(fd, DIR_WR);  /* for connect status */
 
@@ -618,8 +618,8 @@ static int tcp_connect_write(int fd)
        /* The FD is ready now, we can hand the handlers to the socket layer
         * and forward the event there to start working on the socket.
         */
-       fdtab[fd].cb[DIR_RD].f = si_data(si)->read;
-       fdtab[fd].cb[DIR_WR].f = si_data(si)->write;
+       fdtab[fd].cb[DIR_RD].f = NULL;
+       fdtab[fd].cb[DIR_WR].f = NULL;
        si->conn.flags &= ~CO_FL_WAIT_L4_CONN;
        si->exp = TICK_ETERNITY;
        return si_data(si)->write(fd);
index 0b0c3dacbebeb281f479ff07f9a0c1800e78f25d..0e6c11e0df157e0c98b57db34e1b7768c471cd2f 100644 (file)
@@ -26,6 +26,7 @@
 #include <proto/backend.h>
 #include <proto/buffers.h>
 #include <proto/checks.h>
+#include <proto/connection.h>
 #include <proto/dumpstats.h>
 #include <proto/freq_ctr.h>
 #include <proto/frontend.h>
@@ -282,9 +283,9 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        fd_insert(cfd);
        fdtab[cfd].owner = &s->si[0];
        fdtab[cfd].flags = 0;
-       fdtab[cfd].cb[DIR_RD].f = si_data(&s->si[0])->read;
-       fdtab[cfd].cb[DIR_WR].f = si_data(&s->si[0])->write;
-       fdtab[cfd].iocb = NULL;
+       fdtab[cfd].cb[DIR_RD].f = NULL;
+       fdtab[cfd].cb[DIR_WR].f = NULL;
+       fdtab[cfd].iocb = conn_fd_handler;
        EV_FD_SET(cfd, DIR_RD);
 
        if (p->accept && (ret = p->accept(s)) <= 0) {