mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
* released 1.1.2
* fixed a bug in buffer management where we could have a loop between event_read() and process_{cli|srv} if R==BUFSIZE-MAXREWRITE. => implemented an adjustable buffer limit. * fixed a bug : expiration of tasks in wait queue timeout is used again, and running tasks are skipped. * added some debug lines for accept events. * send warnings for servers up/down.
This commit is contained in:
parent
efae1847c3
commit
ef900ab0f4
42
examples/cfg
42
examples/cfg
@ -7,11 +7,12 @@ listen proxy1 0.0.0.0:8000
|
|||||||
#dispatch 127.0.0.1:31300
|
#dispatch 127.0.0.1:31300
|
||||||
#dispatch 127.0.0.1:80
|
#dispatch 127.0.0.1:80
|
||||||
#dispatch 127.0.0.1:22
|
#dispatch 127.0.0.1:22
|
||||||
server tuxlocal 127.0.0.1:80 cookie cookie1 check
|
#server tuxlocal 127.0.0.1:80 cookie cookie1 check
|
||||||
server tuxceleron 10.101.0.1:80 cookie cookie2 check
|
#server tuxceleron 10.101.0.1:80 cookie cookie2 check
|
||||||
#server telnet 127.0.0.1:23
|
#server telnet 127.0.0.1:23
|
||||||
#server ssh 127.0.0.1:22
|
#server ssh 127.0.0.1:22
|
||||||
server local 127.0.0.1:3130 cookie cookie3 check
|
server local 127.0.0.1:3130 cookie cookie3 check
|
||||||
|
#server local 127.0.0.1:8001 cookie cookie3 check
|
||||||
#server local 127.0.0.1:3130
|
#server local 127.0.0.1:3130
|
||||||
#server celeron 10.101.0.1:80 cookie srv1
|
#server celeron 10.101.0.1:80 cookie srv1
|
||||||
#server celeron 10.101.0.1:31300
|
#server celeron 10.101.0.1:31300
|
||||||
@ -28,10 +29,39 @@ listen proxy1 0.0.0.0:8000
|
|||||||
#rspadd Set-Cookie:\ mycookie=0;\ path=/
|
#rspadd Set-Cookie:\ mycookie=0;\ path=/
|
||||||
#rsprep ^(Date:\ )([^,]*)(,\ )(.*) LaDate\ est:\ \4\ (\2)
|
#rsprep ^(Date:\ )([^,]*)(,\ )(.*) LaDate\ est:\ \4\ (\2)
|
||||||
|
|
||||||
listen proxy1 0.0.0.0:3128
|
listen proxy1 0.0.0.0:8001
|
||||||
mode http
|
mode http
|
||||||
cookie SERVERID indirect
|
#mode tcp
|
||||||
dispatch 127.0.0.1:8080
|
dispatch 127.0.0.1:80
|
||||||
|
#dispatch 127.0.0.1:31300
|
||||||
|
#dispatch 127.0.0.1:80
|
||||||
|
#dispatch 127.0.0.1:22
|
||||||
|
#server tuxlocal 127.0.0.1:80 cookie cookie1 check
|
||||||
|
#server tuxceleron 10.101.0.1:80 cookie cookie2 check
|
||||||
|
#server telnet 127.0.0.1:23
|
||||||
|
#server ssh 127.0.0.1:22
|
||||||
|
#server local 127.0.0.1:3130 cookie cookie3 check
|
||||||
|
#server local 127.0.0.1:3130
|
||||||
|
#server celeron 10.101.0.1:80 cookie srv1
|
||||||
|
#server celeron 10.101.0.1:31300
|
||||||
|
#server local 10.101.23.9:31300
|
||||||
|
contimeout 3000
|
||||||
|
clitimeout 150000
|
||||||
|
srvtimeout 150000
|
||||||
|
maxconn 60000
|
||||||
|
redispatch
|
||||||
|
retries 3
|
||||||
|
grace 3000
|
||||||
|
#rsprep ^Server.* Server:\ IIS
|
||||||
|
#rspdel ^Server.*
|
||||||
|
rspadd Set-Cookie:\ SERVERID=12345678;\ path=/
|
||||||
|
#rsprep ^(Date:\ )([^,]*)(,\ )(.*) LaDate\ est:\ \4\ (\2)
|
||||||
|
|
||||||
|
listen proxy1 0.0.0.0:3128
|
||||||
|
disabled
|
||||||
|
mode http
|
||||||
|
cookie SERVERID insert indirect
|
||||||
|
#dispatch 127.0.0.1:8080
|
||||||
server srv1 127.0.0.1:8080
|
server srv1 127.0.0.1:8080
|
||||||
#server srv2 192.168.12.3:8080
|
#server srv2 192.168.12.3:8080
|
||||||
contimeout 3000
|
contimeout 3000
|
||||||
@ -41,9 +71,11 @@ listen proxy1 0.0.0.0:3128
|
|||||||
redispatch
|
redispatch
|
||||||
retries 3
|
retries 3
|
||||||
grace 3000
|
grace 3000
|
||||||
|
rspdel ^Via:.*
|
||||||
|
|
||||||
|
|
||||||
listen proxy2 0.0.0.0:3129
|
listen proxy2 0.0.0.0:3129
|
||||||
|
disabled
|
||||||
mode http
|
mode http
|
||||||
transparent
|
transparent
|
||||||
# dispatch 127.0.0.1:80
|
# dispatch 127.0.0.1:80
|
||||||
|
235
haproxy.c
235
haproxy.c
@ -7,8 +7,21 @@
|
|||||||
* as published by the Free Software Foundation; either version
|
* as published by the Free Software Foundation; either version
|
||||||
* 2 of the License, or (at your option) any later version.
|
* 2 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
|
* Pending bugs :
|
||||||
|
* - cookie in insert+indirect mode sometimes segfaults !
|
||||||
|
* - a proxy with an invalid config will prevent the startup even if disabled.
|
||||||
|
*
|
||||||
* ChangeLog :
|
* ChangeLog :
|
||||||
*
|
*
|
||||||
|
* 2002/03/21
|
||||||
|
* - released 1.1.2
|
||||||
|
* - fixed a bug in buffer management where we could have a loop
|
||||||
|
* between event_read() and process_{cli|srv} if R==BUFSIZE-MAXREWRITE.
|
||||||
|
* => implemented an adjustable buffer limit.
|
||||||
|
* - fixed a bug : expiration of tasks in wait queue timeout is used again,
|
||||||
|
* and running tasks are skipped.
|
||||||
|
* - added some debug lines for accept events.
|
||||||
|
* - send warnings for servers up/down.
|
||||||
* 2002/03/12
|
* 2002/03/12
|
||||||
* - released 1.1.1
|
* - released 1.1.1
|
||||||
* - fixed a bug in total failure handling
|
* - fixed a bug in total failure handling
|
||||||
@ -82,8 +95,8 @@
|
|||||||
#include <linux/netfilter_ipv4.h>
|
#include <linux/netfilter_ipv4.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAPROXY_VERSION "1.1.1"
|
#define HAPROXY_VERSION "1.1.2"
|
||||||
#define HAPROXY_DATE "2002/03/13"
|
#define HAPROXY_DATE "2002/03/22"
|
||||||
|
|
||||||
/* this is for libc5 for example */
|
/* this is for libc5 for example */
|
||||||
#ifndef TCP_NODELAY
|
#ifndef TCP_NODELAY
|
||||||
@ -294,6 +307,7 @@ struct hdr_exp {
|
|||||||
struct buffer {
|
struct buffer {
|
||||||
unsigned int l; /* data length */
|
unsigned int l; /* data length */
|
||||||
char *r, *w, *h, *lr; /* read ptr, write ptr, last header ptr, last read */
|
char *r, *w, *h, *lr; /* read ptr, write ptr, last header ptr, last read */
|
||||||
|
char *rlim; /* read limit, used for header rewriting */
|
||||||
char data[BUFSIZE];
|
char data[BUFSIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -735,18 +749,18 @@ unsigned long tv_delta(struct timeval *tv1, struct timeval *tv2) {
|
|||||||
*/
|
*/
|
||||||
static inline int tv_cmp_ms(struct timeval *tv1, struct timeval *tv2) {
|
static inline int tv_cmp_ms(struct timeval *tv1, struct timeval *tv2) {
|
||||||
if (tv1->tv_sec == tv2->tv_sec) {
|
if (tv1->tv_sec == tv2->tv_sec) {
|
||||||
if (tv1->tv_usec >= tv2->tv_usec + 1000)
|
if (tv1->tv_usec > tv2->tv_usec + 1000)
|
||||||
return 1;
|
return 1;
|
||||||
else if (tv2->tv_usec >= tv1->tv_usec + 1000)
|
else if (tv2->tv_usec > tv1->tv_usec + 1000)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((tv1->tv_sec > tv2->tv_sec + 1) ||
|
else if ((tv1->tv_sec > tv2->tv_sec + 1) ||
|
||||||
((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000)))
|
((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 > tv2->tv_usec + 1000)))
|
||||||
return 1;
|
return 1;
|
||||||
else if ((tv2->tv_sec > tv1->tv_sec + 1) ||
|
else if ((tv2->tv_sec > tv1->tv_sec + 1) ||
|
||||||
((tv2->tv_sec == tv1->tv_sec + 1) && (tv2->tv_usec + 1000000 >= tv1->tv_usec + 1000)))
|
((tv2->tv_sec == tv1->tv_sec + 1) && (tv2->tv_usec + 1000000 > tv1->tv_usec + 1000)))
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -759,7 +773,6 @@ static inline int tv_cmp_ms(struct timeval *tv1, struct timeval *tv2) {
|
|||||||
static inline unsigned long tv_remain(struct timeval *tv1, struct timeval *tv2) {
|
static inline unsigned long tv_remain(struct timeval *tv1, struct timeval *tv2) {
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
|
|
||||||
|
|
||||||
if (tv_cmp_ms(tv1, tv2) >= 0)
|
if (tv_cmp_ms(tv1, tv2) >= 0)
|
||||||
return 0; /* event elapsed */
|
return 0; /* event elapsed */
|
||||||
|
|
||||||
@ -830,18 +843,18 @@ static inline int tv_cmp2_ms(struct timeval *tv1, struct timeval *tv2) {
|
|||||||
return -1; /* tv2 later than tv1 */
|
return -1; /* tv2 later than tv1 */
|
||||||
|
|
||||||
if (tv1->tv_sec == tv2->tv_sec) {
|
if (tv1->tv_sec == tv2->tv_sec) {
|
||||||
if (tv1->tv_usec >= tv2->tv_usec + 1000)
|
if (tv1->tv_usec > tv2->tv_usec + 1000)
|
||||||
return 1;
|
return 1;
|
||||||
else if (tv2->tv_usec >= tv1->tv_usec + 1000)
|
else if (tv2->tv_usec > tv1->tv_usec + 1000)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((tv1->tv_sec > tv2->tv_sec + 1) ||
|
else if ((tv1->tv_sec > tv2->tv_sec + 1) ||
|
||||||
((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000)))
|
((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 > tv2->tv_usec + 1000)))
|
||||||
return 1;
|
return 1;
|
||||||
else if ((tv2->tv_sec > tv1->tv_sec + 1) ||
|
else if ((tv2->tv_sec > tv1->tv_sec + 1) ||
|
||||||
((tv2->tv_sec == tv1->tv_sec + 1) && (tv2->tv_usec + 1000000 >= tv1->tv_usec + 1000)))
|
((tv2->tv_sec == tv1->tv_sec + 1) && (tv2->tv_usec + 1000000 > tv1->tv_usec + 1000)))
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
@ -1146,20 +1159,24 @@ int event_cli_read(int fd) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
if (b->l == 0) { /* let's realign the buffer to optimize I/O */
|
if (b->l == 0) { /* let's realign the buffer to optimize I/O */
|
||||||
b->r = b->w = b->h = b->lr = b->data;
|
b->r = b->w = b->h = b->lr = b->data;
|
||||||
max = BUFSIZE - MAXREWRITE;
|
max = b->rlim - b->data;
|
||||||
}
|
}
|
||||||
else if (b->r > b->w) {
|
else if (b->r > b->w) {
|
||||||
max = b->data + BUFSIZE - MAXREWRITE - b->r;
|
max = b->rlim - b->r;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
max = b->w - b->r;
|
max = b->w - b->r;
|
||||||
if (max > BUFSIZE - MAXREWRITE)
|
/* FIXME: theorically, if w>0, we shouldn't have rlim < data+size anymore
|
||||||
max = BUFSIZE - MAXREWRITE;
|
* since it means that the rewrite protection has been removed. This
|
||||||
|
* implies that the if statement can be removed.
|
||||||
|
*/
|
||||||
|
if (max > b->rlim - b->data)
|
||||||
|
max = b->rlim - b->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max == 0) { /* not anymore room to store data */
|
if (max == 0) { /* not anymore room to store data */
|
||||||
FD_CLR(fd, StaticReadEvent);
|
FD_CLR(fd, StaticReadEvent);
|
||||||
break;;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
@ -1235,15 +1252,19 @@ int event_srv_read(int fd) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
if (b->l == 0) { /* let's realign the buffer to optimize I/O */
|
if (b->l == 0) { /* let's realign the buffer to optimize I/O */
|
||||||
b->r = b->w = b->h = b->lr = b->data;
|
b->r = b->w = b->h = b->lr = b->data;
|
||||||
max = BUFSIZE - MAXREWRITE;
|
max = b->rlim - b->data;
|
||||||
}
|
}
|
||||||
else if (b->r > b->w) {
|
else if (b->r > b->w) {
|
||||||
max = b->data + BUFSIZE - MAXREWRITE - b->r;
|
max = b->rlim - b->r;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
max = b->w - b->r;
|
max = b->w - b->r;
|
||||||
if (max > BUFSIZE - MAXREWRITE)
|
/* FIXME: theorically, if w>0, we shouldn't have rlim < data+size anymore
|
||||||
max = BUFSIZE - MAXREWRITE;
|
* since it means that the rewrite protection has been removed. This
|
||||||
|
* implies that the if statement can be removed.
|
||||||
|
*/
|
||||||
|
if (max > b->rlim - b->data)
|
||||||
|
max = b->rlim - b->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max == 0) { /* not anymore room to store data */
|
if (max == 0) { /* not anymore room to store data */
|
||||||
@ -1330,20 +1351,12 @@ int event_cli_write(int fd) {
|
|||||||
else
|
else
|
||||||
max = b->data + BUFSIZE - b->w;
|
max = b->data + BUFSIZE - b->w;
|
||||||
|
|
||||||
if (max == 0) {
|
|
||||||
// FD_CLR(fd, StaticWriteEvent); // useless
|
|
||||||
//fprintf(stderr, "cli_write(%d) : max=%d, d=%p, r=%p, w=%p, l=%d\n",
|
|
||||||
//fd, max, b->data, b->r, b->w, b->l);
|
|
||||||
s->res_cw = RES_NULL;
|
|
||||||
task_wakeup(&rq, t);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fdtab[fd].state != FD_STERROR) {
|
if (fdtab[fd].state != FD_STERROR) {
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
int skerr, lskerr;
|
int skerr, lskerr;
|
||||||
#endif
|
#endif
|
||||||
if (max == 0) { /* nothing to write, just make as if we were never called */
|
|
||||||
|
if (max == 0) {
|
||||||
s->res_cw = RES_NULL;
|
s->res_cw = RES_NULL;
|
||||||
task_wakeup(&rq, t);
|
task_wakeup(&rq, t);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1420,28 +1433,19 @@ int event_srv_write(int fd) {
|
|||||||
else
|
else
|
||||||
max = b->data + BUFSIZE - b->w;
|
max = b->data + BUFSIZE - b->w;
|
||||||
|
|
||||||
if (max == 0) {
|
|
||||||
/* may be we have received a connection acknowledgement in TCP mode without data */
|
|
||||||
// FD_CLR(fd, StaticWriteEvent); // useless ?
|
|
||||||
//fprintf(stderr, "srv_write(%d) : max=%d, d=%p, r=%p, w=%p, l=%d\n",
|
|
||||||
//fd, max, b->data, b->r, b->w, b->l);
|
|
||||||
s->res_sw = RES_NULL;
|
|
||||||
task_wakeup(&rq, t);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fdtab[fd].state != FD_STERROR) {
|
if (fdtab[fd].state != FD_STERROR) {
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
int skerr, lskerr;
|
int skerr, lskerr;
|
||||||
#endif
|
#endif
|
||||||
fdtab[fd].state = FD_STREADY;
|
if (max == 0) {
|
||||||
if (max == 0) { /* nothing to write, just make as if we were never called, except to finish a connect() */
|
/* may be we have received a connection acknowledgement in TCP mode without data */
|
||||||
//FD_CLR(fd, StaticWriteEvent); // useless ?
|
|
||||||
s->res_sw = RES_NULL;
|
s->res_sw = RES_NULL;
|
||||||
task_wakeup(&rq, t);
|
task_wakeup(&rq, t);
|
||||||
|
fdtab[fd].state = FD_STREADY;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
lskerr=sizeof(skerr);
|
lskerr=sizeof(skerr);
|
||||||
getsockopt(fd, SOL_SOCKET, SO_ERROR, &skerr, &lskerr);
|
getsockopt(fd, SOL_SOCKET, SO_ERROR, &skerr, &lskerr);
|
||||||
@ -1452,6 +1456,7 @@ int event_srv_write(int fd) {
|
|||||||
#else
|
#else
|
||||||
ret = send(fd, b->w, max, MSG_DONTWAIT | MSG_NOSIGNAL);
|
ret = send(fd, b->w, max, MSG_DONTWAIT | MSG_NOSIGNAL);
|
||||||
#endif
|
#endif
|
||||||
|
fdtab[fd].state = FD_STREADY;
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
b->l -= ret;
|
b->l -= ret;
|
||||||
b->w += ret;
|
b->w += ret;
|
||||||
@ -1501,7 +1506,6 @@ int event_accept(int fd) {
|
|||||||
int cfd;
|
int cfd;
|
||||||
int one = 1;
|
int one = 1;
|
||||||
|
|
||||||
|
|
||||||
while (p->nbconn < p->maxconn) {
|
while (p->nbconn < p->maxconn) {
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
int laddr = sizeof(addr);
|
int laddr = sizeof(addr);
|
||||||
@ -1572,6 +1576,11 @@ int event_accept(int fd) {
|
|||||||
send_syslog(&p->logsrv2, p->logfac2, LOG_INFO, message);
|
send_syslog(&p->logsrv2, p->logfac2, LOG_INFO, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((mode & MODE_DEBUG) && !(mode & MODE_QUIET)) {
|
||||||
|
int len;
|
||||||
|
len = sprintf(trash, "accept(%04x)=%04x\n", (unsigned short)fd, (unsigned short)cfd);
|
||||||
|
write(1, trash, len);
|
||||||
|
}
|
||||||
|
|
||||||
t->next = t->prev = t->rqnext = NULL; /* task not in run queue yet */
|
t->next = t->prev = t->rqnext = NULL; /* task not in run queue yet */
|
||||||
t->wq = LIST_HEAD(wait_queue); /* but already has a wait queue assigned */
|
t->wq = LIST_HEAD(wait_queue); /* but already has a wait queue assigned */
|
||||||
@ -1598,6 +1607,9 @@ int event_accept(int fd) {
|
|||||||
}
|
}
|
||||||
s->req->l = 0;
|
s->req->l = 0;
|
||||||
s->req->h = s->req->r = s->req->lr = s->req->w = s->req->data; /* r and w will be reset further */
|
s->req->h = s->req->r = s->req->lr = s->req->w = s->req->data; /* r and w will be reset further */
|
||||||
|
s->req->rlim = s->req->data + BUFSIZE;
|
||||||
|
if (s->cli_state == CL_STHEADERS) /* reserver some space for header rewriting */
|
||||||
|
s->req->rlim -= MAXREWRITE;
|
||||||
|
|
||||||
if ((s->rep = pool_alloc(buffer)) == NULL) { /* no memory */
|
if ((s->rep = pool_alloc(buffer)) == NULL) { /* no memory */
|
||||||
pool_free(buffer, s->req);
|
pool_free(buffer, s->req);
|
||||||
@ -1607,7 +1619,7 @@ int event_accept(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
s->rep->l = 0;
|
s->rep->l = 0;
|
||||||
s->rep->h = s->rep->r = s->rep->lr = s->rep->w = s->rep->data;
|
s->rep->h = s->rep->r = s->rep->lr = s->rep->w = s->rep->rlim = s->rep->data;
|
||||||
|
|
||||||
fdtab[cfd].read = &event_cli_read;
|
fdtab[cfd].read = &event_cli_read;
|
||||||
fdtab[cfd].write = &event_cli_write;
|
fdtab[cfd].write = &event_cli_write;
|
||||||
@ -1616,6 +1628,7 @@ int event_accept(int fd) {
|
|||||||
|
|
||||||
if (p->mode == PR_MODE_HEALTH) { /* health check mode, no client reading */
|
if (p->mode == PR_MODE_HEALTH) { /* health check mode, no client reading */
|
||||||
FD_CLR(cfd, StaticReadEvent);
|
FD_CLR(cfd, StaticReadEvent);
|
||||||
|
FD_SET(cfd, StaticWriteEvent);
|
||||||
tv_eternity(&s->crexpire);
|
tv_eternity(&s->crexpire);
|
||||||
shutdown(s->cli_fd, SHUT_RD);
|
shutdown(s->cli_fd, SHUT_RD);
|
||||||
s->cli_state = CL_STSHUTR;
|
s->cli_state = CL_STSHUTR;
|
||||||
@ -1643,6 +1656,8 @@ int event_accept(int fd) {
|
|||||||
t->expire = s->crexpire;
|
t->expire = s->crexpire;
|
||||||
|
|
||||||
task_queue(t);
|
task_queue(t);
|
||||||
|
|
||||||
|
if (p->mode != PR_MODE_HEALTH)
|
||||||
task_wakeup(&rq, t);
|
task_wakeup(&rq, t);
|
||||||
|
|
||||||
p->nbconn++;
|
p->nbconn++;
|
||||||
@ -1815,12 +1830,13 @@ int process_cli(struct session *t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t->cli_state = CL_STDATA;
|
t->cli_state = CL_STDATA;
|
||||||
|
req->rlim = req->data + BUFSIZE; /* no more rewrite needed */
|
||||||
|
|
||||||
/* FIXME: we'll set the client in a wait state while we try to
|
/* FIXME: we'll set the client in a wait state while we try to
|
||||||
* connect to the server. Is this really needed ? wouldn't it be
|
* connect to the server. Is this really needed ? wouldn't it be
|
||||||
* better to release the maximum of system buffers instead ? */
|
* better to release the maximum of system buffers instead ? */
|
||||||
FD_CLR(t->cli_fd, StaticReadEvent);
|
//FD_CLR(t->cli_fd, StaticReadEvent);
|
||||||
tv_eternity(&t->crexpire);
|
//tv_eternity(&t->crexpire);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1965,7 +1981,12 @@ int process_cli(struct session *t) {
|
|||||||
|
|
||||||
/* end of header processing (even if incomplete) */
|
/* end of header processing (even if incomplete) */
|
||||||
|
|
||||||
if ((req->l < BUFSIZE - MAXREWRITE) && ! FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
|
||||||
|
if ((req->l < req->rlim - req->data) && ! FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
||||||
|
/* fd in StaticReadEvent was disabled, perhaps because of a previous buffer
|
||||||
|
* full. We cannot loop here since event_cli_read will disable it only if
|
||||||
|
* req->l == rlim-data
|
||||||
|
*/
|
||||||
FD_SET(t->cli_fd, StaticReadEvent);
|
FD_SET(t->cli_fd, StaticReadEvent);
|
||||||
if (t->proxy->clitimeout)
|
if (t->proxy->clitimeout)
|
||||||
tv_delayfrom(&t->crexpire, &now, t->proxy->clitimeout);
|
tv_delayfrom(&t->crexpire, &now, t->proxy->clitimeout);
|
||||||
@ -1973,26 +1994,17 @@ int process_cli(struct session *t) {
|
|||||||
tv_eternity(&t->crexpire);
|
tv_eternity(&t->crexpire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read timeout, read error, or last read : give up */
|
/* read timeout, read error, or last read : give up.
|
||||||
if (t->res_cr == RES_ERROR || t->res_cr == RES_NULL ||
|
* since we are in header mode, if there's no space left for headers, we
|
||||||
tv_cmp2_ms(&t->crexpire, &now) <= 0) {
|
* won't be able to free more later, so the session will never terminate.
|
||||||
//FD_CLR(t->cli_fd, StaticReadEvent);
|
*/
|
||||||
//FD_CLR(t->cli_fd, StaticWriteEvent);
|
if (t->res_cr == RES_ERROR || t->res_cr == RES_NULL
|
||||||
|
|| req->l >= req->rlim - req->data || tv_cmp2_ms(&t->crexpire, &now) <= 0) {
|
||||||
tv_eternity(&t->crexpire);
|
tv_eternity(&t->crexpire);
|
||||||
fd_delete(t->cli_fd);
|
fd_delete(t->cli_fd);
|
||||||
//close(t->cli_fd);
|
|
||||||
t->cli_state = CL_STCLOSE;
|
t->cli_state = CL_STCLOSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// else if (t->res_cr == RES_SILENT) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (req->l >= BUFSIZE - MAXREWRITE) {
|
|
||||||
/* buffer full : stop reading till we free some space */
|
|
||||||
FD_CLR(t->cli_fd, StaticReadEvent);
|
|
||||||
tv_eternity(&t->crexpire);
|
|
||||||
}
|
|
||||||
|
|
||||||
return t->cli_state != CL_STHEADERS;
|
return t->cli_state != CL_STHEADERS;
|
||||||
}
|
}
|
||||||
@ -2002,9 +2014,6 @@ int process_cli(struct session *t) {
|
|||||||
tv_eternity(&t->crexpire);
|
tv_eternity(&t->crexpire);
|
||||||
tv_eternity(&t->cwexpire);
|
tv_eternity(&t->cwexpire);
|
||||||
fd_delete(t->cli_fd);
|
fd_delete(t->cli_fd);
|
||||||
//FD_CLR(t->cli_fd, StaticReadEvent);
|
|
||||||
//FD_CLR(t->cli_fd, StaticWriteEvent);
|
|
||||||
//close(t->cli_fd);
|
|
||||||
t->cli_state = CL_STCLOSE;
|
t->cli_state = CL_STCLOSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2022,7 +2031,6 @@ int process_cli(struct session *t) {
|
|||||||
/* write timeout, or last server read and buffer empty */
|
/* write timeout, or last server read and buffer empty */
|
||||||
else if (((s == SV_STSHUTR || s == SV_STCLOSE) && (rep->l == 0))
|
else if (((s == SV_STSHUTR || s == SV_STCLOSE) && (rep->l == 0))
|
||||||
||(tv_cmp2_ms(&t->cwexpire, &now) <= 0)) {
|
||(tv_cmp2_ms(&t->cwexpire, &now) <= 0)) {
|
||||||
|
|
||||||
FD_CLR(t->cli_fd, StaticWriteEvent);
|
FD_CLR(t->cli_fd, StaticWriteEvent);
|
||||||
tv_eternity(&t->cwexpire);
|
tv_eternity(&t->cwexpire);
|
||||||
shutdown(t->cli_fd, SHUT_WR);
|
shutdown(t->cli_fd, SHUT_WR);
|
||||||
@ -2030,13 +2038,16 @@ int process_cli(struct session *t) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req->l >= BUFSIZE - MAXREWRITE) { /* no room to read more data */
|
if (req->l >= req->rlim - req->data) {
|
||||||
|
/* no room to read more data */
|
||||||
if (FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
if (FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
||||||
|
/* stop reading until we get some space */
|
||||||
FD_CLR(t->cli_fd, StaticReadEvent);
|
FD_CLR(t->cli_fd, StaticReadEvent);
|
||||||
tv_eternity(&t->crexpire);
|
tv_eternity(&t->crexpire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* there's still some space in the buffer */
|
||||||
if (! FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
if (! FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
||||||
FD_SET(t->cli_fd, StaticReadEvent);
|
FD_SET(t->cli_fd, StaticReadEvent);
|
||||||
if (t->proxy->clitimeout)
|
if (t->proxy->clitimeout)
|
||||||
@ -2068,10 +2079,8 @@ int process_cli(struct session *t) {
|
|||||||
if ((t->res_cw == RES_ERROR) ||
|
if ((t->res_cw == RES_ERROR) ||
|
||||||
((s == SV_STSHUTR || s == SV_STCLOSE) && (rep->l == 0))
|
((s == SV_STSHUTR || s == SV_STCLOSE) && (rep->l == 0))
|
||||||
|| (tv_cmp2_ms(&t->crexpire, &now) <= 0)) {
|
|| (tv_cmp2_ms(&t->crexpire, &now) <= 0)) {
|
||||||
//FD_CLR(t->cli_fd, StaticWriteEvent);
|
|
||||||
tv_eternity(&t->cwexpire);
|
tv_eternity(&t->cwexpire);
|
||||||
fd_delete(t->cli_fd);
|
fd_delete(t->cli_fd);
|
||||||
//close(t->cli_fd);
|
|
||||||
t->cli_state = CL_STCLOSE;
|
t->cli_state = CL_STCLOSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2096,20 +2105,21 @@ int process_cli(struct session *t) {
|
|||||||
else if (c == CL_STSHUTW) {
|
else if (c == CL_STSHUTW) {
|
||||||
if (t->res_cr == RES_ERROR || t->res_cr == RES_NULL || s == SV_STSHUTW ||
|
if (t->res_cr == RES_ERROR || t->res_cr == RES_NULL || s == SV_STSHUTW ||
|
||||||
s == SV_STCLOSE || tv_cmp2_ms(&t->cwexpire, &now) <= 0) {
|
s == SV_STCLOSE || tv_cmp2_ms(&t->cwexpire, &now) <= 0) {
|
||||||
//FD_CLR(t->cli_fd, StaticReadEvent);
|
|
||||||
tv_eternity(&t->crexpire);
|
tv_eternity(&t->crexpire);
|
||||||
fd_delete(t->cli_fd);
|
fd_delete(t->cli_fd);
|
||||||
//close(t->cli_fd);
|
|
||||||
t->cli_state = CL_STCLOSE;
|
t->cli_state = CL_STCLOSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (req->l >= BUFSIZE - MAXREWRITE) { /* no room to read more data */
|
else if (req->l >= req->rlim - req->data) {
|
||||||
|
/* no room to read more data */
|
||||||
if (FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
if (FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
||||||
|
/* stop reading until we get some space */
|
||||||
FD_CLR(t->cli_fd, StaticReadEvent);
|
FD_CLR(t->cli_fd, StaticReadEvent);
|
||||||
tv_eternity(&t->crexpire);
|
tv_eternity(&t->crexpire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* there's still some space in the buffer */
|
||||||
if (! FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
if (! FD_ISSET(t->cli_fd, StaticReadEvent)) {
|
||||||
FD_SET(t->cli_fd, StaticReadEvent);
|
FD_SET(t->cli_fd, StaticReadEvent);
|
||||||
if (t->proxy->clitimeout)
|
if (t->proxy->clitimeout)
|
||||||
@ -2223,9 +2233,12 @@ int process_srv(struct session *t) {
|
|||||||
tv_eternity(&t->srexpire);
|
tv_eternity(&t->srexpire);
|
||||||
|
|
||||||
t->srv_state = SV_STDATA;
|
t->srv_state = SV_STDATA;
|
||||||
|
rep->rlim = rep->data + BUFSIZE; /* no rewrite needed */
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
t->srv_state = SV_STHEADERS;
|
t->srv_state = SV_STHEADERS;
|
||||||
|
rep->rlim = rep->data + BUFSIZE - MAXREWRITE; /* rewrite needed */
|
||||||
|
}
|
||||||
tv_eternity(&t->cnexpire);
|
tv_eternity(&t->cnexpire);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2266,6 +2279,7 @@ int process_srv(struct session *t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t->srv_state = SV_STDATA;
|
t->srv_state = SV_STDATA;
|
||||||
|
rep->rlim = rep->data + BUFSIZE; /* no more rewrite needed */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2408,7 +2422,11 @@ int process_srv(struct session *t) {
|
|||||||
|
|
||||||
/* end of header processing (even if incomplete) */
|
/* end of header processing (even if incomplete) */
|
||||||
|
|
||||||
if ((rep->l < BUFSIZE - MAXREWRITE) && ! FD_ISSET(t->srv_fd, StaticReadEvent)) {
|
if ((rep->l < rep->rlim - rep->data) && ! FD_ISSET(t->srv_fd, StaticReadEvent)) {
|
||||||
|
/* fd in StaticReadEvent was disabled, perhaps because of a previous buffer
|
||||||
|
* full. We cannot loop here since event_srv_read will disable it only if
|
||||||
|
* rep->l == rlim-data
|
||||||
|
*/
|
||||||
FD_SET(t->srv_fd, StaticReadEvent);
|
FD_SET(t->srv_fd, StaticReadEvent);
|
||||||
if (t->proxy->srvtimeout)
|
if (t->proxy->srvtimeout)
|
||||||
tv_delayfrom(&t->srexpire, &now, t->proxy->srvtimeout);
|
tv_delayfrom(&t->srexpire, &now, t->proxy->srvtimeout);
|
||||||
@ -2420,16 +2438,16 @@ int process_srv(struct session *t) {
|
|||||||
if (t->res_sw == RES_ERROR || t->res_sr == RES_ERROR) {
|
if (t->res_sw == RES_ERROR || t->res_sr == RES_ERROR) {
|
||||||
tv_eternity(&t->srexpire);
|
tv_eternity(&t->srexpire);
|
||||||
tv_eternity(&t->swexpire);
|
tv_eternity(&t->swexpire);
|
||||||
//FD_CLR(t->srv_fd, StaticReadEvent);
|
|
||||||
//FD_CLR(t->srv_fd, StaticWriteEvent);
|
|
||||||
//close(t->srv_fd);
|
|
||||||
fd_delete(t->srv_fd);
|
fd_delete(t->srv_fd);
|
||||||
t->srv_state = SV_STCLOSE;
|
t->srv_state = SV_STCLOSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* read timeout, last read, or end of client write */
|
/* read timeout, last read, or end of client write
|
||||||
else if (t->res_sr == RES_NULL || c == CL_STSHUTW || c == CL_STCLOSE ||
|
* since we are in header mode, if there's no space left for headers, we
|
||||||
tv_cmp2_ms(&t->srexpire, &now) <= 0) {
|
* won't be able to free more later, so the session will never terminate.
|
||||||
|
*/
|
||||||
|
else if (t->res_sr == RES_NULL || c == CL_STSHUTW || c == CL_STCLOSE
|
||||||
|
|| rep->l >= rep->rlim - rep->data || tv_cmp2_ms(&t->srexpire, &now) <= 0) {
|
||||||
FD_CLR(t->srv_fd, StaticReadEvent);
|
FD_CLR(t->srv_fd, StaticReadEvent);
|
||||||
tv_eternity(&t->srexpire);
|
tv_eternity(&t->srexpire);
|
||||||
shutdown(t->srv_fd, SHUT_RD);
|
shutdown(t->srv_fd, SHUT_RD);
|
||||||
@ -2463,13 +2481,6 @@ int process_srv(struct session *t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rep->l >= BUFSIZE - MAXREWRITE) { /* no room to read more data */
|
|
||||||
if (FD_ISSET(t->srv_fd, StaticReadEvent)) {
|
|
||||||
FD_CLR(t->srv_fd, StaticReadEvent);
|
|
||||||
tv_eternity(&t->srexpire);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* be nice with the client side which would like to send a complete header
|
/* be nice with the client side which would like to send a complete header
|
||||||
* FIXME: COMPLETELY BUGGY !!! not all headers may be processed because the client
|
* FIXME: COMPLETELY BUGGY !!! not all headers may be processed because the client
|
||||||
* would read all remaining data at once ! The client should not write past rep->lr
|
* would read all remaining data at once ! The client should not write past rep->lr
|
||||||
@ -2483,17 +2494,13 @@ int process_srv(struct session *t) {
|
|||||||
if (t->res_sw == RES_ERROR || t->res_sr == RES_ERROR) {
|
if (t->res_sw == RES_ERROR || t->res_sr == RES_ERROR) {
|
||||||
tv_eternity(&t->srexpire);
|
tv_eternity(&t->srexpire);
|
||||||
tv_eternity(&t->swexpire);
|
tv_eternity(&t->swexpire);
|
||||||
//FD_CLR(t->srv_fd, StaticReadEvent);
|
|
||||||
//FD_CLR(t->srv_fd, StaticWriteEvent);
|
|
||||||
//close(t->srv_fd);
|
|
||||||
fd_delete(t->srv_fd);
|
fd_delete(t->srv_fd);
|
||||||
t->srv_state = SV_STCLOSE;
|
t->srv_state = SV_STCLOSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* read timeout, last read, or end of client write */
|
/* read timeout, last read, or end of client write */
|
||||||
else if (t->res_sr == RES_NULL || c == CL_STSHUTW || c == CL_STCLOSE ||
|
else if (t->res_sr == RES_NULL || c == CL_STSHUTW || c == CL_STCLOSE
|
||||||
tv_cmp2_ms(&t->srexpire, &now) <= 0) {
|
|| tv_cmp2_ms(&t->srexpire, &now) <= 0) {
|
||||||
|
|
||||||
FD_CLR(t->srv_fd, StaticReadEvent);
|
FD_CLR(t->srv_fd, StaticReadEvent);
|
||||||
tv_eternity(&t->srexpire);
|
tv_eternity(&t->srexpire);
|
||||||
shutdown(t->srv_fd, SHUT_RD);
|
shutdown(t->srv_fd, SHUT_RD);
|
||||||
@ -2502,8 +2509,8 @@ int process_srv(struct session *t) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
/* write timeout, or last client read and buffer empty */
|
/* write timeout, or last client read and buffer empty */
|
||||||
else if (((c == CL_STSHUTR || c == CL_STCLOSE) && (req->l == 0)) ||
|
else if (((c == CL_STSHUTR || c == CL_STCLOSE) && (req->l == 0))
|
||||||
(tv_cmp2_ms(&t->swexpire, &now) <= 0)) {
|
|| (tv_cmp2_ms(&t->swexpire, &now) <= 0)) {
|
||||||
FD_CLR(t->srv_fd, StaticWriteEvent);
|
FD_CLR(t->srv_fd, StaticWriteEvent);
|
||||||
tv_eternity(&t->swexpire);
|
tv_eternity(&t->swexpire);
|
||||||
shutdown(t->srv_fd, SHUT_WR);
|
shutdown(t->srv_fd, SHUT_WR);
|
||||||
@ -2672,7 +2679,7 @@ int process_chk(struct task *t) {
|
|||||||
int fd = s->curfd;
|
int fd = s->curfd;
|
||||||
int one = 1;
|
int one = 1;
|
||||||
|
|
||||||
//fprintf(stderr, "process_chk: 1\n");
|
//fprintf(stderr, "process_chk: task=%p\n", t);
|
||||||
|
|
||||||
if (fd < 0) { /* no check currently running */
|
if (fd < 0) { /* no check currently running */
|
||||||
//fprintf(stderr, "process_chk: 2\n");
|
//fprintf(stderr, "process_chk: 2\n");
|
||||||
@ -2724,6 +2731,9 @@ int process_chk(struct task *t) {
|
|||||||
if (s->health > FALLTIME)
|
if (s->health > FALLTIME)
|
||||||
s->health--; /* still good */
|
s->health--; /* still good */
|
||||||
else {
|
else {
|
||||||
|
if (s->health == FALLTIME && !(mode & MODE_QUIET))
|
||||||
|
Warning("server %s DOWN.\n", s->id);
|
||||||
|
|
||||||
s->health = 0; /* failure */
|
s->health = 0; /* failure */
|
||||||
s->state &= ~SRV_RUNNING;
|
s->state &= ~SRV_RUNNING;
|
||||||
}
|
}
|
||||||
@ -2738,11 +2748,14 @@ int process_chk(struct task *t) {
|
|||||||
//fprintf(stderr, "process_chk: 9\n");
|
//fprintf(stderr, "process_chk: 9\n");
|
||||||
s->health++; /* was bad, stays for a while */
|
s->health++; /* was bad, stays for a while */
|
||||||
if (s->health >= FALLTIME) {
|
if (s->health >= FALLTIME) {
|
||||||
|
if (s->health == FALLTIME && !(mode & MODE_QUIET))
|
||||||
|
Warning("server %s UP.\n", s->id);
|
||||||
|
|
||||||
s->health = FALLTIME + RISETIME -1; /* OK now */
|
s->health = FALLTIME + RISETIME -1; /* OK now */
|
||||||
s->state |= SRV_RUNNING;
|
s->state |= SRV_RUNNING;
|
||||||
}
|
}
|
||||||
s->curfd = -1;
|
s->curfd = -1; /* no check running anymore */
|
||||||
FD_CLR(fd, StaticWriteEvent);
|
//FD_CLR(fd, StaticWriteEvent);
|
||||||
fd_delete(fd);
|
fd_delete(fd);
|
||||||
tv_delayfrom(&t->expire, &now, CHK_INTERVAL);
|
tv_delayfrom(&t->expire, &now, CHK_INTERVAL);
|
||||||
}
|
}
|
||||||
@ -2752,11 +2765,14 @@ int process_chk(struct task *t) {
|
|||||||
if (s->health > FALLTIME)
|
if (s->health > FALLTIME)
|
||||||
s->health--; /* still good */
|
s->health--; /* still good */
|
||||||
else {
|
else {
|
||||||
|
if (s->health == FALLTIME && !(mode & MODE_QUIET))
|
||||||
|
Warning("server %s DOWN.\n", s->id);
|
||||||
|
|
||||||
s->health = 0; /* failure */
|
s->health = 0; /* failure */
|
||||||
s->state &= ~SRV_RUNNING;
|
s->state &= ~SRV_RUNNING;
|
||||||
}
|
}
|
||||||
s->curfd = -1;
|
s->curfd = -1;
|
||||||
FD_CLR(fd, StaticWriteEvent);
|
//FD_CLR(fd, StaticWriteEvent);
|
||||||
fd_delete(fd);
|
fd_delete(fd);
|
||||||
tv_delayfrom(&t->expire, &now, CHK_INTERVAL);
|
tv_delayfrom(&t->expire, &now, CHK_INTERVAL);
|
||||||
}
|
}
|
||||||
@ -2797,14 +2813,22 @@ void select_loop() {
|
|||||||
tnext = ((struct task *)LIST_HEAD(wait_queue))->next;
|
tnext = ((struct task *)LIST_HEAD(wait_queue))->next;
|
||||||
while ((t = tnext) != LIST_HEAD(wait_queue)) { /* we haven't looped ? */
|
while ((t = tnext) != LIST_HEAD(wait_queue)) { /* we haven't looped ? */
|
||||||
tnext = t->next;
|
tnext = t->next;
|
||||||
|
if (t->state & TASK_RUNNING)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* wakeup expired entries. It doesn't matter if they are
|
/* wakeup expired entries. It doesn't matter if they are
|
||||||
* already running because of a previous event
|
* already running because of a previous event
|
||||||
*/
|
*/
|
||||||
if (tv_cmp2_ms(&t->expire, &now) <= 0) {
|
if (tv_cmp2_ms(&t->expire, &now) <= 0) {
|
||||||
|
//fprintf(stderr,"task_wakeup(%p, %p)\n", &rq, t);
|
||||||
task_wakeup(&rq, t);
|
task_wakeup(&rq, t);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* first non-runnable task. Use its expiration date as an upper bound */
|
||||||
|
int temp_time = tv_remain(&now, &t->expire);
|
||||||
|
if (temp_time)
|
||||||
|
next_time = temp_time;
|
||||||
|
//fprintf(stderr,"no_task_wakeup(%p, %p) : expire in %d ms\n", &rq, t, temp_time);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2818,11 +2842,13 @@ void select_loop() {
|
|||||||
|
|
||||||
tnext = t->rqnext;
|
tnext = t->rqnext;
|
||||||
task_sleep(&rq, t);
|
task_sleep(&rq, t);
|
||||||
|
//fprintf(stderr,"task %p\n",t);
|
||||||
temp_time = t->process(t);
|
temp_time = t->process(t);
|
||||||
next_time = MINTIME(temp_time, next_time);
|
next_time = MINTIME(temp_time, next_time);
|
||||||
|
//fprintf(stderr,"process(%p)=%d -> next_time=%d)\n", t, temp_time, next_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//fprintf(stderr,"---end of run---\n");
|
||||||
|
|
||||||
/* maintain all proxies in a consistent state. This should quickly become a task */
|
/* maintain all proxies in a consistent state. This should quickly become a task */
|
||||||
time2 = maintain_proxies();
|
time2 = maintain_proxies();
|
||||||
@ -2898,9 +2924,6 @@ void select_loop() {
|
|||||||
if (FD_ISSET(fd, ReadEvent))
|
if (FD_ISSET(fd, ReadEvent))
|
||||||
fdtab[fd].read(fd);
|
fdtab[fd].read(fd);
|
||||||
|
|
||||||
if (fdtab[fd].state == FD_STCLOSE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (FD_ISSET(fd, WriteEvent))
|
if (FD_ISSET(fd, WriteEvent))
|
||||||
fdtab[fd].write(fd);
|
fdtab[fd].write(fd);
|
||||||
}
|
}
|
||||||
@ -3569,6 +3592,10 @@ int readcfgfile(char *file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (curproxy != NULL) {
|
while (curproxy != NULL) {
|
||||||
|
if (curproxy->state == PR_STDISABLED) {
|
||||||
|
curproxy = curproxy->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((curproxy->mode != PR_MODE_HEALTH) &&
|
if ((curproxy->mode != PR_MODE_HEALTH) &&
|
||||||
!(curproxy->options & (PR_O_TRANSP | PR_O_BALANCE)) &&
|
!(curproxy->options & (PR_O_TRANSP | PR_O_BALANCE)) &&
|
||||||
(*(int *)&curproxy->dispatch_addr == 0)) {
|
(*(int *)&curproxy->dispatch_addr == 0)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user