mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
[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:
parent
7a9664872e
commit
3d32d3a849
@ -43,14 +43,26 @@ enum {
|
|||||||
DIR_SIZE
|
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 */
|
/* info about one given fd */
|
||||||
struct fdtab {
|
struct fdtab {
|
||||||
struct {
|
struct {
|
||||||
int (*f)(int fd); /* read/write function */
|
int (*f)(int fd); /* read/write function */
|
||||||
struct buffer *b; /* read/write buffer */
|
struct buffer *b; /* read/write buffer */
|
||||||
} cb[DIR_SIZE];
|
} cb[DIR_SIZE];
|
||||||
struct task *owner; /* the session (or proxy) associated with this fd */
|
struct task *owner; /* the session (or proxy) associated with this fd */
|
||||||
int state; /* the state of this fd */
|
unsigned char state; /* the state of this fd */
|
||||||
|
unsigned char ev; /* event seen in return of poll() : FD_POLL_* */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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].f = &event_srv_chk_w;
|
||||||
fdtab[fd].cb[DIR_WR].b = NULL;
|
fdtab[fd].cb[DIR_WR].b = NULL;
|
||||||
fdtab[fd].state = FD_STCONN; /* connection in progress */
|
fdtab[fd].state = FD_STCONN; /* connection in progress */
|
||||||
|
fdtab[fd].ev = 0;
|
||||||
EV_FD_SET(fd, DIR_WR); /* for connect status */
|
EV_FD_SET(fd, DIR_WR); /* for connect status */
|
||||||
#ifdef DEBUG_FULL
|
#ifdef DEBUG_FULL
|
||||||
assert (!EV_FD_ISSET(fd, DIR_RD));
|
assert (!EV_FD_ISSET(fd, DIR_RD));
|
||||||
|
@ -385,6 +385,7 @@ int event_accept(int fd) {
|
|||||||
fdtab[cfd].cb[DIR_RD].b = s->req;
|
fdtab[cfd].cb[DIR_RD].b = s->req;
|
||||||
fdtab[cfd].cb[DIR_WR].f = &stream_sock_write;
|
fdtab[cfd].cb[DIR_WR].f = &stream_sock_write;
|
||||||
fdtab[cfd].cb[DIR_WR].b = s->rep;
|
fdtab[cfd].cb[DIR_WR].b = s->rep;
|
||||||
|
fdtab[cfd].ev = 0;
|
||||||
|
|
||||||
if ((p->mode == PR_MODE_HTTP && (s->flags & SN_MONITOR)) ||
|
if ((p->mode == PR_MODE_HTTP && (s->flags & SN_MONITOR)) ||
|
||||||
(p->mode == PR_MODE_HEALTH && (p->options & PR_O_HTTP_CHK))) {
|
(p->mode == PR_MODE_HEALTH && (p->options & PR_O_HTTP_CHK))) {
|
||||||
|
@ -153,6 +153,7 @@ int start_proxies(int verbose)
|
|||||||
fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
|
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].owner = (struct task *)curproxy; /* reference the proxy instead of a task */
|
||||||
fdtab[fd].state = FD_STLISTEN;
|
fdtab[fd].state = FD_STLISTEN;
|
||||||
|
fdtab[fd].ev = 0;
|
||||||
listeners++;
|
listeners++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user