[MEDIUM] remove cli_fd, srv_fd, cli_state and srv_state from the session

Those were previously used by the unix sockets only, and could be
removed.
This commit is contained in:
Willy Tarreau 2008-12-07 16:27:56 +01:00
parent b1356cf4e4
commit 7e5067d459
6 changed files with 9 additions and 31 deletions

View 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 */

View File

@ -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

View 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;

View 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 */

View 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 &&

View 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.