[MINOR] add support for the polling results in fdtab

Now fdtab can contain the FD_POLL_* events so that the pollers
which can fill them can give userful information to readers and
writers about the precise condition of wakeup.
This commit is contained in:
Willy Tarreau 2007-04-15 11:31:05 +02:00
parent 7a9664872e
commit 3d32d3a849
4 changed files with 17 additions and 2 deletions

View File

@ -43,14 +43,26 @@ enum {
DIR_SIZE
};
#define FD_POLL_IN 0x01
#define FD_POLL_PRI 0x02
#define FD_POLL_OUT 0x04
#define FD_POLL_ERR 0x08
#define FD_POLL_HUP 0x10
#define FD_POLL_ANY 0x1F
#define FD_POLL_RD (FD_POLL_IN | FD_POLL_ERR | FD_POLL_HUP)
#define FD_POLL_WR (FD_POLL_OUT | FD_POLL_ERR | FD_POLL_HUP)
/* info about one given fd */
struct fdtab {
struct {
int (*f)(int fd); /* read/write function */
struct buffer *b; /* read/write buffer */
} cb[DIR_SIZE];
struct task *owner; /* the session (or proxy) associated with this fd */
int state; /* the state of this fd */
struct task *owner; /* the session (or proxy) associated with this fd */
unsigned char state; /* the state of this fd */
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
};
/*

View File

@ -336,6 +336,7 @@ int process_chk(struct task *t)
fdtab[fd].cb[DIR_WR].f = &event_srv_chk_w;
fdtab[fd].cb[DIR_WR].b = NULL;
fdtab[fd].state = FD_STCONN; /* connection in progress */
fdtab[fd].ev = 0;
EV_FD_SET(fd, DIR_WR); /* for connect status */
#ifdef DEBUG_FULL
assert (!EV_FD_ISSET(fd, DIR_RD));

View File

@ -385,6 +385,7 @@ int event_accept(int fd) {
fdtab[cfd].cb[DIR_RD].b = s->req;
fdtab[cfd].cb[DIR_WR].f = &stream_sock_write;
fdtab[cfd].cb[DIR_WR].b = s->rep;
fdtab[cfd].ev = 0;
if ((p->mode == PR_MODE_HTTP && (s->flags & SN_MONITOR)) ||
(p->mode == PR_MODE_HEALTH && (p->options & PR_O_HTTP_CHK))) {

View File

@ -153,6 +153,7 @@ int start_proxies(int verbose)
fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
fdtab[fd].owner = (struct task *)curproxy; /* reference the proxy instead of a task */
fdtab[fd].state = FD_STLISTEN;
fdtab[fd].ev = 0;
listeners++;
}