]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] stream_interface: add and use ->update function to resync
authorWilly Tarreau <w@1wt.eu>
Tue, 18 Aug 2009 05:38:19 +0000 (07:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 18 Aug 2009 05:38:19 +0000 (07:38 +0200)
We used to call stream_sock_data_finish() directly at the end of
a session update, but if we want to support non-socket interfaces,
we need to have this function configurable. Now we access it via
->update().

include/types/stream_interface.h
src/client.c
src/proto_uxst.c
src/session.c

index 7789323fdbc19b6d63461bc6b9591958475b49b9..c9b0e55906f58dfe459b764a54f7cd7d251cb10e 100644 (file)
@@ -82,12 +82,13 @@ struct stream_interface {
        int fd;                 /* file descriptor for a stream driver when known */
        unsigned int flags;
        unsigned int exp;       /* wake up time for connect, queue, turn-around, ... */
-       int (*connect)(struct stream_interface *, struct proxy *, struct server *,
-                      struct sockaddr *, struct sockaddr *); /* connect function if any */
+       void (*update)(struct stream_interface *); /* update function */
        void (*shutr)(struct stream_interface *);  /* shutr function */
        void (*shutw)(struct stream_interface *);  /* shutw function */
        void (*chk_rcv)(struct stream_interface *);/* chk_rcv function */
        void (*chk_snd)(struct stream_interface *);/* chk_snd function */
+       int (*connect)(struct stream_interface *, struct proxy *, struct server *,
+                      struct sockaddr *, struct sockaddr *); /* connect function if any */
        struct buffer *ib, *ob; /* input and output buffers */
        unsigned int err_type;  /* first error detected, one of SI_ET_* */
        void *err_loc;          /* commonly the server, NULL when SI_ET_NONE */
index 76ea122c988a5e6f720e6b2a6ab32bd0f5b53eea..312d896823e1d417fb60b7b26896716e54ed32e0 100644 (file)
@@ -191,11 +191,12 @@ int event_accept(int fd) {
                s->si[0].err_type = SI_ET_NONE;
                s->si[0].err_loc = NULL;
                s->si[0].owner = t;
-               s->si[0].connect = NULL;
+               s->si[0].update = stream_sock_data_finish;
                s->si[0].shutr = stream_sock_shutr;
                s->si[0].shutw = stream_sock_shutw;
                s->si[0].chk_rcv = stream_sock_chk_rcv;
                s->si[0].chk_snd = stream_sock_chk_snd;
+               s->si[0].connect = NULL;
                s->si[0].fd = cfd;
                s->si[0].flags = SI_FL_NONE | SI_FL_CAP_SPLTCP; /* TCP splicing capable */
                s->si[0].exp = TICK_ETERNITY;
@@ -204,11 +205,12 @@ int event_accept(int fd) {
                s->si[1].err_type = SI_ET_NONE;
                s->si[1].err_loc = NULL;
                s->si[1].owner = t;
-               s->si[1].connect = tcpv4_connect_server;
+               s->si[1].update = stream_sock_data_finish;
                s->si[1].shutr = stream_sock_shutr;
                s->si[1].shutw = stream_sock_shutw;
                s->si[1].chk_rcv = stream_sock_chk_rcv;
                s->si[1].chk_snd = stream_sock_chk_snd;
+               s->si[1].connect = tcpv4_connect_server;
                s->si[1].exp = TICK_ETERNITY;
                s->si[1].fd = -1; /* just to help with debugging */
                s->si[1].flags = SI_FL_NONE;
index c811f64a84564b97339700ed9b215d336b0f316d..60efb6dd7114642468b8353930bac36ab981526c 100644 (file)
@@ -445,11 +445,12 @@ int uxst_event_accept(int fd) {
                s->si[0].err_type = SI_ET_NONE;
                s->si[0].err_loc = NULL;
                s->si[0].owner = t;
-               s->si[0].connect = NULL;
+               s->si[0].update = stream_sock_data_finish;
                s->si[0].shutr = stream_sock_shutr;
                s->si[0].shutw = stream_sock_shutw;
                s->si[0].chk_rcv = stream_sock_chk_rcv;
                s->si[0].chk_snd = stream_sock_chk_snd;
+               s->si[0].connect = NULL;
                s->si[0].fd = cfd;
                s->si[0].flags = SI_FL_NONE;
                s->si[0].exp = TICK_ETERNITY;
@@ -458,11 +459,12 @@ int uxst_event_accept(int fd) {
                s->si[1].err_type = SI_ET_NONE;
                s->si[1].err_loc = NULL;
                s->si[1].owner = t;
-               s->si[1].connect = NULL;
+               s->si[1].update = stream_sock_data_finish;
                s->si[1].shutr = stream_sock_shutr;
                s->si[1].shutw = stream_sock_shutw;
                s->si[1].chk_rcv = stream_sock_chk_rcv;
                s->si[1].chk_snd = stream_sock_chk_snd;
+               s->si[1].connect = NULL;
                s->si[1].exp = TICK_ETERNITY;
                s->si[1].fd = -1; /* just to help with debugging */
                s->si[1].flags = SI_FL_NONE;
index f0c2d8658eeca00ac51ea3581ceabd19cfe7db23..698321241bfa6d9d80e3327f767f95516577345d 100644 (file)
@@ -1163,10 +1163,10 @@ resync_stream_interface:
                        session_process_counters(s);
 
                if (s->rep->cons->state == SI_ST_EST)
-                       stream_sock_data_finish(s->rep->cons);
+                       s->rep->cons->update(s->rep->cons);
 
                if (s->req->cons->state == SI_ST_EST)
-                       stream_sock_data_finish(s->req->cons);
+                       s->req->cons->update(s->req->cons);
 
                s->req->flags &= ~(BF_READ_NULL|BF_READ_PARTIAL|BF_WRITE_NULL|BF_WRITE_PARTIAL);
                s->rep->flags &= ~(BF_READ_NULL|BF_READ_PARTIAL|BF_WRITE_NULL|BF_WRITE_PARTIAL);