mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
[MINOR] recompute maxfd before touching fdtab
It may be dangerous to play with fdtab before doing fd_insert() because this last one is responsible for growing maxfd as needed. Call fd_insert() before instead.
This commit is contained in:
parent
69cad1a338
commit
7a9664872e
@ -329,6 +329,7 @@ int process_chk(struct task *t)
|
|||||||
//fprintf(stderr, "process_chk: 4\n");
|
//fprintf(stderr, "process_chk: 4\n");
|
||||||
|
|
||||||
s->curfd = fd; /* that's how we know a test is in progress ;-) */
|
s->curfd = fd; /* that's how we know a test is in progress ;-) */
|
||||||
|
fd_insert(fd);
|
||||||
fdtab[fd].owner = t;
|
fdtab[fd].owner = t;
|
||||||
fdtab[fd].cb[DIR_RD].f = &event_srv_chk_r;
|
fdtab[fd].cb[DIR_RD].f = &event_srv_chk_r;
|
||||||
fdtab[fd].cb[DIR_RD].b = NULL;
|
fdtab[fd].cb[DIR_RD].b = NULL;
|
||||||
@ -339,7 +340,6 @@ int process_chk(struct task *t)
|
|||||||
#ifdef DEBUG_FULL
|
#ifdef DEBUG_FULL
|
||||||
assert (!EV_FD_ISSET(fd, DIR_RD));
|
assert (!EV_FD_ISSET(fd, DIR_RD));
|
||||||
#endif
|
#endif
|
||||||
fd_insert(fd);
|
|
||||||
/* FIXME: we allow up to <inter> for a connection to establish, but we should use another parameter */
|
/* FIXME: we allow up to <inter> for a connection to establish, but we should use another parameter */
|
||||||
tv_delayfrom(&t->expire, &now, s->inter);
|
tv_delayfrom(&t->expire, &now, s->inter);
|
||||||
task_queue(t); /* restore t to its place in the task list */
|
task_queue(t); /* restore t to its place in the task list */
|
||||||
|
@ -378,6 +378,7 @@ int event_accept(int fd) {
|
|||||||
s->rep->wto = s->fe->clitimeout;
|
s->rep->wto = s->fe->clitimeout;
|
||||||
s->rep->cto = 0;
|
s->rep->cto = 0;
|
||||||
|
|
||||||
|
fd_insert(cfd);
|
||||||
fdtab[cfd].owner = t;
|
fdtab[cfd].owner = t;
|
||||||
fdtab[cfd].state = FD_STREADY;
|
fdtab[cfd].state = FD_STREADY;
|
||||||
fdtab[cfd].cb[DIR_RD].f = &stream_sock_read;
|
fdtab[cfd].cb[DIR_RD].f = &stream_sock_read;
|
||||||
@ -402,8 +403,6 @@ int event_accept(int fd) {
|
|||||||
EV_FD_SET(cfd, DIR_RD);
|
EV_FD_SET(cfd, DIR_RD);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd_insert(cfd);
|
|
||||||
|
|
||||||
tv_eternity(&s->req->rex);
|
tv_eternity(&s->req->rex);
|
||||||
tv_eternity(&s->req->wex);
|
tv_eternity(&s->req->wex);
|
||||||
tv_eternity(&s->req->cex);
|
tv_eternity(&s->req->cex);
|
||||||
|
@ -147,12 +147,12 @@ int start_proxies(int verbose)
|
|||||||
listener->fd = fd;
|
listener->fd = fd;
|
||||||
|
|
||||||
/* the function for the accept() event */
|
/* the function for the accept() event */
|
||||||
|
fd_insert(fd);
|
||||||
fdtab[fd].cb[DIR_RD].f = &event_accept;
|
fdtab[fd].cb[DIR_RD].f = &event_accept;
|
||||||
fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
|
fdtab[fd].cb[DIR_WR].f = NULL; /* never called */
|
||||||
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;
|
||||||
fd_insert(fd);
|
|
||||||
listeners++;
|
listeners++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user