]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] remove cli_fd, srv_fd, cli_state and srv_state from the session
authorWilly Tarreau <w@1wt.eu>
Sun, 7 Dec 2008 15:27:56 +0000 (16:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 7 Dec 2008 15:27:56 +0000 (16:27 +0100)
Those were previously used by the unix sockets only, and could be
removed.

include/types/session.h
src/backend.c
src/client.c
src/haproxy.c
src/proto_uxst.c
src/session.c

index d37d2ebf65d1ed2eb5178eac348e7a4b980450c3..574f93341b7c2c33f5d1e3e38d84a8222dc0184a 100644 (file)
@@ -157,9 +157,6 @@ struct session {
        /* application specific below */
        struct proxy *fe;                       /* the proxy this session depends on for the client side */
        struct proxy *be;                       /* the proxy this session depends on for the server side */
-       int cli_fd;                             /* the client side fd */
-       int cli_state;                          /* state of the client side */
-       int srv_state;                          /* state of the server side */
        int conn_retries;                       /* number of connect retries left */
        int flags;                              /* some flags describing the session */
        unsigned term_trace;                    /* term trace: 4*8 bits indicating which part of the code closed */
index e9125b46d1d49627b8cc3539445242b673c6892e..986c07072ae5b51ff5d534cfd7654d3ae8fcb712 100644 (file)
@@ -1664,7 +1664,7 @@ int connect_server(struct session *s)
                /* this is a resource error */
                return SN_ERR_RESOURCE;
        }
-       
+
        if (fd >= global.maxsock) {
                /* do not log anything there, it's a normal condition when this option
                 * is used to serialize connections to a server !
@@ -1677,7 +1677,7 @@ int connect_server(struct session *s)
 #ifdef CONFIG_HAP_TCPSPLICE
        if ((s->fe->options & s->be->options) & PR_O_TCPSPLICE) {
                /* TCP splicing supported by both FE and BE */
-               tcp_splice_initfd(s->cli_fd, fd);
+               tcp_splice_initfd(s->req->prod->fd, fd);
        }
 #endif
 
index d3cf47dbde650b1d0e557ab4ee8ac2814d621884..a01bb527e635c8e3c89b133b0511a66afaeb1fa9 100644 (file)
@@ -46,8 +46,8 @@ void get_frt_addr(struct session *s)
 {
        socklen_t namelen = sizeof(s->frt_addr);
 
-       if (get_original_dst(s->cli_fd, (struct sockaddr_in *)&s->frt_addr, &namelen) == -1)
-               getsockname(s->cli_fd, (struct sockaddr *)&s->frt_addr, &namelen);
+       if (get_original_dst(s->si[0].fd, (struct sockaddr_in *)&s->frt_addr, &namelen) == -1)
+               getsockname(s->si[0].fd, (struct sockaddr *)&s->frt_addr, &namelen);
        s->flags |= SN_FRT_ADDR_SET;
 }
 
@@ -170,7 +170,6 @@ int event_accept(int fd) {
                        s->flags |= SN_BE_ASSIGNED;
                }
 
-               s->cli_state = CL_STDATA;
                s->ana_state = 0;  /* analysers may change it but must reset it upon exit */
                s->req = s->rep = NULL; /* will be allocated later */
 
@@ -183,7 +182,6 @@ int event_accept(int fd) {
                s->si[0].fd = cfd;
                s->si[0].flags = SI_FL_NONE;
                s->si[0].exp = TICK_ETERNITY;
-               s->cli_fd = cfd;
 
                s->si[1].state = s->si[1].prev_state = SI_ST_INI;
                s->si[1].err_type = SI_ET_NONE;
index c936bf05f7e610a85e2087db2d107dfc0dfd22ce..261a4be49bc21489d8fe6ddcbe00336b20bcb9a5 100644 (file)
@@ -325,17 +325,11 @@ void dump(int sig)
                t = rb_entry(node, struct task, rb_node);
                s = t->context;
                qfprintf(stderr,"[dump] wq: task %p, still %ld ms, "
-                        "cli=%d, srv=%d, cr=%d, cw=%d, sr=%d, sw=%d, "
-                        "req=%d, rep=%d, clifd=%d\n",
+                        "cli=%d, srv=%d, req=%d, rep=%d\n",
                         s, tv_ms_remain(&now, &t->expire),
-                        s->cli_state,
-                        s->srv_state,
-                        EV_FD_ISSET(s->cli_fd, DIR_RD),
-                        EV_FD_ISSET(s->cli_fd, DIR_WR),
-                        EV_FD_ISSET(s->srv_fd, DIR_RD),
-                        EV_FD_ISSET(s->srv_fd, DIR_WR),
-                        s->req->l, s->rep?s->rep->l:0, s->cli_fd
-                        );
+                        s->si[0].state,
+                        s->si[1].state,
+                        s->req->l, s->rep?s->rep->l:0);
        }
 #endif
        /* dump memory usage then free everything possible */
index 0cb365ce89df397c4806e9941bbb29d8976703f4..b3bf7545cd3ef6e7df7d6046901d9bd3907ea723 100644 (file)
@@ -441,7 +441,6 @@ int uxst_event_accept(int fd) {
                s->fe = NULL;
                s->be = NULL;
 
-               s->cli_state = CL_STDATA;
                s->ana_state = 0;
                s->req = s->rep = NULL; /* will be allocated later */
 
@@ -454,7 +453,6 @@ int uxst_event_accept(int fd) {
                s->si[0].fd = cfd;
                s->si[0].flags = SI_FL_NONE;
                s->si[0].exp = TICK_ETERNITY;
-               s->cli_fd = cfd;
 
                s->si[1].state = s->si[1].prev_state = SI_ST_INI;
                s->si[1].err_type = SI_ET_NONE;
@@ -939,7 +937,7 @@ void uxst_process_session(struct task *t, int *next)
        }
 
        actconn--;
-       listener = fdtab[s->cli_fd].listener;
+       listener = fdtab[s->si[0].fd].listener;
        if (listener) {
                listener->nbconn--;
                if (listener->state == LI_FULL &&
index 29ddb6f93e964dcfd35888ed323d4ecfd93f369c..e19bb56300daab4522229d2e246d99ea6865ba24 100644 (file)
@@ -151,15 +151,6 @@ int sess_update_st_con_tcp(struct session *s, struct stream_interface *si)
        struct buffer *req = si->ob;
        struct buffer *rep = si->ib;
 
-       DPRINTF(stderr,"[%u] %s: c=%s exp(r,w)=%u,%u req=%08x rep=%08x rql=%d rpl=%d, fds=%d\n",
-               now_ms, __FUNCTION__,
-               cli_stnames[s->cli_state],
-               rep->rex, req->wex,
-               req->flags, rep->flags,
-               req->l, rep->l,
-               fdtab[si->fd].state);
-
-
        /* If we got an error, or if nothing happened and the connection timed
         * out, we must give up. The CER state handler will take care of retry
         * attempts and error reports.