File descriptors states.
Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
struct sockaddr *peeraddr; /* pointer to peer's network address, or NULL if unset */
socklen_t peerlen; /* peer's address length, or 0 if unset */
- struct listener *listener; /* the listener which created this fd, or NULL if unset */
};
/*
struct list list; /* position in global sessions list */
struct task *task; /* the task associated with this session */
/* application specific below */
+ struct listener *listener; /* the listener by which the request arrived */
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 conn_retries; /* number of connect retries left */
t->context = s;
s->task = t;
+ s->listener = l;
s->be = s->fe = p;
/* in HTTP mode, content switching requires that the backend
fd_insert(cfd);
fdtab[cfd].owner = &s->si[0];
- fdtab[cfd].listener = l;
fdtab[cfd].state = FD_STREADY;
fdtab[cfd].cb[DIR_RD].f = l->proto->read;
fdtab[cfd].cb[DIR_RD].b = s->req;
fdtab[fd].state = FD_STLISTEN;
fdtab[fd].peeraddr = NULL;
fdtab[fd].peerlen = 0;
- fdtab[fd].listener = NULL;
tcp_return:
if (msg && errlen)
strlcpy2(errmsg, msg, errlen);
fdtab[fd].state = FD_STLISTEN;
fdtab[fd].peeraddr = NULL;
fdtab[fd].peerlen = 0;
- fdtab[fd].listener = NULL;
return ERR_NONE;
}
t->nice = -64; /* we want to boost priority for local stats */
s->task = t;
+ s->listener = l;
s->fe = NULL;
s->be = NULL;
fd_insert(cfd);
fdtab[cfd].owner = &s->si[0];
- fdtab[cfd].listener = l;
fdtab[cfd].state = FD_STREADY;
fdtab[cfd].cb[DIR_RD].f = l->proto->read;
fdtab[cfd].cb[DIR_RD].b = s->req;
void uxst_process_session(struct task *t, int *next)
{
struct session *s = t->context;
- struct listener *listener;
int resync;
unsigned int rqf_last, rpf_last;
}
actconn--;
- listener = fdtab[s->si[0].fd].listener;
- if (listener) {
- listener->nbconn--;
- if (listener->state == LI_FULL &&
- listener->nbconn < listener->maxconn) {
+ if (s->listener) {
+ s->listener->nbconn--;
+ if (s->listener->state == LI_FULL &&
+ s->listener->nbconn < s->listener->maxconn) {
/* we should reactivate the listener */
- EV_FD_SET(listener->fd, DIR_RD);
- listener->state = LI_READY;
+ EV_FD_SET(s->listener->fd, DIR_RD);
+ s->listener->state = LI_READY;
}
}