#include <types/fd.h>
#include <types/global.h>
+#include <proto/fd.h>
#include <proto/polling.h>
#include <proto/task.h>
******************************/
+#if !defined(CONFIG_HAP_INLINE_FD_SET)
+/*
+ * Benchmarks performed on a Pentium-M notebook show that using functions
+ * instead of the usual macros improve the FD_* performance by about 80%,
+ * and that marking them regparm(2) adds another 20%.
+ */
+void __attribute__((regparm(2))) my_fd_set(const int fd, fd_set *ev)
+{
+ FD_SET(fd, ev);
+}
+
+void __attribute__((regparm(2))) my_fd_clr(const int fd, fd_set *ev)
+{
+ FD_CLR(fd, ev);
+}
+
+int __attribute__((regparm(2))) my_fd_isset(const int fd, const fd_set *ev)
+{
+ return FD_ISSET(fd, ev);
+}
+#endif
+
+
/*
* FIXME: this is dirty, but at the moment, there's no other solution to remove
* the old FDs from outside the loop. Perhaps we should export a global 'poll'
sr = (rn >> count) & 1;
sw = (wn >> count) & 1;
#else
- pr = FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&ro);
- pw = FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&wo);
- sr = FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&rn);
- sw = FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&wn);
+ pr = MY_FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&ro);
+ pw = MY_FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&wo);
+ sr = MY_FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&rn);
+ sw = MY_FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&wn);
#endif
#else
- pr = FD_ISSET(fd, PrevReadEvent);
- pw = FD_ISSET(fd, PrevWriteEvent);
- sr = FD_ISSET(fd, StaticReadEvent);
- sw = FD_ISSET(fd, StaticWriteEvent);
+ pr = MY_FD_ISSET(fd, PrevReadEvent);
+ pw = MY_FD_ISSET(fd, PrevWriteEvent);
+ sr = MY_FD_ISSET(fd, StaticReadEvent);
+ sw = MY_FD_ISSET(fd, StaticWriteEvent);
#endif
if (!((sr^pr) | (sw^pw)))
continue;
for (count = 0; count < status; count++) {
fd = epoll_events[count].data.fd;
- if (FD_ISSET(fd, StaticReadEvent)) {
+ if (MY_FD_ISSET(fd, StaticReadEvent)) {
if (fdtab[fd].state == FD_STCLOSE)
continue;
if (epoll_events[count].events & ( EPOLLIN | EPOLLERR | EPOLLHUP ))
fdtab[fd].cb[DIR_RD].f(fd);
}
- if (FD_ISSET(fd, StaticWriteEvent)) {
+ if (MY_FD_ISSET(fd, StaticWriteEvent)) {
if (fdtab[fd].state == FD_STCLOSE)
continue;
if (epoll_events[count].events & ( EPOLLOUT | EPOLLERR | EPOLLHUP ))
sr = (rn >> count) & 1;
sw = (wn >> count) & 1;
#else
- sr = FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&rn);
- sw = FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&wn);
+ sr = MY_FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&rn);
+ sw = MY_FD_ISSET(fd&((1<<INTBITS)-1), (typeof(fd_set*))&wn);
#endif
#else
- sr = FD_ISSET(fd, StaticReadEvent);
- sw = FD_ISSET(fd, StaticWriteEvent);
+ sr = MY_FD_ISSET(fd, StaticReadEvent);
+ sw = MY_FD_ISSET(fd, StaticWriteEvent);
#endif
if ((sr|sw)) {
poll_events[nbfd].fd = fd;
/* ok, we found one active fd */
status--;
- if (FD_ISSET(fd, StaticReadEvent)) {
+ if (MY_FD_ISSET(fd, StaticReadEvent)) {
if (fdtab[fd].state == FD_STCLOSE)
continue;
if (poll_events[count].revents & ( POLLIN | POLLERR | POLLHUP ))
fdtab[fd].cb[DIR_RD].f(fd);
}
- if (FD_ISSET(fd, StaticWriteEvent)) {
+ if (MY_FD_ISSET(fd, StaticWriteEvent)) {
if (fdtab[fd].state == FD_STCLOSE)
continue;
if (poll_events[count].revents & ( POLLOUT | POLLERR | POLLHUP ))
// /* just a verification code, needs to be removed for performance */
// for (i=0; i<maxfd; i++) {
- // if (FD_ISSET(i, ReadEvent) != FD_ISSET(i, StaticReadEvent))
+ // if (MY_FD_ISSET(i, ReadEvent) != MY_FD_ISSET(i, StaticReadEvent))
// abort();
- // if (FD_ISSET(i, WriteEvent) != FD_ISSET(i, StaticWriteEvent))
+ // if (MY_FD_ISSET(i, WriteEvent) != MY_FD_ISSET(i, StaticWriteEvent))
// abort();
//
// }
/* if we specify read first, the accepts and zero reads will be
* seen first. Moreover, system buffers will be flushed faster.
*/
- if (FD_ISSET(fd, ReadEvent)) {
+ if (MY_FD_ISSET(fd, ReadEvent)) {
if (fdtab[fd].state == FD_STCLOSE)
continue;
fdtab[fd].cb[DIR_RD].f(fd);
}
- if (FD_ISSET(fd, WriteEvent)) {
+ if (MY_FD_ISSET(fd, WriteEvent)) {
if (fdtab[fd].state == FD_STCLOSE)
continue;
fdtab[fd].cb[DIR_WR].f(fd);
*/
void fd_delete(int fd)
{
- FD_CLR(fd, StaticReadEvent);
- FD_CLR(fd, StaticWriteEvent);
+ MY_FD_CLR(fd, StaticReadEvent);
+ MY_FD_CLR(fd, StaticWriteEvent);
#if defined(ENABLE_EPOLL)
if (PrevReadEvent) {
- FD_CLR(fd, PrevReadEvent);
- FD_CLR(fd, PrevWriteEvent);
+ MY_FD_CLR(fd, PrevReadEvent);
+ MY_FD_CLR(fd, PrevWriteEvent);
}
#endif
*/
void client_retnclose(struct session *s, int len, const char *msg)
{
- FD_CLR(s->cli_fd, StaticReadEvent);
- FD_SET(s->cli_fd, StaticWriteEvent);
+ MY_FD_CLR(s->cli_fd, StaticReadEvent);
+ MY_FD_SET(s->cli_fd, StaticWriteEvent);
tv_eternity(&s->req->rex);
if (s->proxy->clitimeout)
tv_delayfrom(&s->rep->wex, &now, s->proxy->clitimeout);
#ifdef DEBUG_FULL
fprintf(stderr,"process_cli: c=%s s=%s set(r,w)=%d,%d exp(r,w)=%d.%d,%d.%d\n",
cli_stnames[c], srv_stnames[s],
- FD_ISSET(t->cli_fd, StaticReadEvent), FD_ISSET(t->cli_fd, StaticWriteEvent),
+ MY_FD_ISSET(t->cli_fd, StaticReadEvent), MY_FD_ISSET(t->cli_fd, StaticWriteEvent),
req->rex.tv_sec, req->rex.tv_usec,
rep->wex.tv_sec, rep->wex.tv_usec);
#endif
//fprintf(stderr,"process_cli: c=%d, s=%d, cr=%d, cw=%d, sr=%d, sw=%d\n", c, s,
- //FD_ISSET(t->cli_fd, StaticReadEvent), FD_ISSET(t->cli_fd, StaticWriteEvent),
- //FD_ISSET(t->srv_fd, StaticReadEvent), FD_ISSET(t->srv_fd, StaticWriteEvent)
+ //MY_FD_ISSET(t->cli_fd, StaticReadEvent), MY_FD_ISSET(t->cli_fd, StaticWriteEvent),
+ //MY_FD_ISSET(t->srv_fd, StaticReadEvent), MY_FD_ISSET(t->srv_fd, StaticWriteEvent)
//);
if (c == CL_STHEADERS) {
/* now parse the partial (or complete) headers */
* eternity as long as the server-side does not enable data xfer.
* CL_STDATA also has to take care of this, which is done below.
*/
- //FD_CLR(t->cli_fd, StaticReadEvent);
+ //MY_FD_CLR(t->cli_fd, StaticReadEvent);
//tv_eternity(&req->rex);
/* FIXME: if we break here (as up to 1.1.23), having the client
/* end of header processing (even if incomplete) */
- if ((req->l < req->rlim - req->data) && ! FD_ISSET(t->cli_fd, StaticReadEvent)) {
+ if ((req->l < req->rlim - req->data) && ! MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
/* fd in StaticReadEvent was disabled, perhaps because of a previous buffer
* full. We cannot loop here since stream_sock_read will disable it only if
* req->l == rlim-data
*/
- FD_SET(t->cli_fd, StaticReadEvent);
+ MY_FD_SET(t->cli_fd, StaticReadEvent);
if (t->proxy->clitimeout)
tv_delayfrom(&req->rex, &now, t->proxy->clitimeout);
else
}
/* last read, or end of server write */
else if (req->flags & BF_READ_NULL || s == SV_STSHUTW || s == SV_STCLOSE) {
- FD_CLR(t->cli_fd, StaticReadEvent);
+ MY_FD_CLR(t->cli_fd, StaticReadEvent);
tv_eternity(&req->rex);
shutdown(t->cli_fd, SHUT_RD);
t->cli_state = CL_STSHUTR;
}
/* last server read and buffer empty */
else if ((s == SV_STSHUTR || s == SV_STCLOSE) && (rep->l == 0)) {
- FD_CLR(t->cli_fd, StaticWriteEvent);
+ MY_FD_CLR(t->cli_fd, StaticWriteEvent);
tv_eternity(&rep->wex);
shutdown(t->cli_fd, SHUT_WR);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->cli_fd, StaticReadEvent);
+ MY_FD_SET(t->cli_fd, StaticReadEvent);
if (t->proxy->clitimeout)
tv_delayfrom(&req->rex, &now, t->proxy->clitimeout);
t->cli_state = CL_STSHUTW;
}
/* read timeout */
else if (tv_cmp2_ms(&req->rex, &now) <= 0) {
- FD_CLR(t->cli_fd, StaticReadEvent);
+ MY_FD_CLR(t->cli_fd, StaticReadEvent);
tv_eternity(&req->rex);
shutdown(t->cli_fd, SHUT_RD);
t->cli_state = CL_STSHUTR;
}
/* write timeout */
else if (tv_cmp2_ms(&rep->wex, &now) <= 0) {
- FD_CLR(t->cli_fd, StaticWriteEvent);
+ MY_FD_CLR(t->cli_fd, StaticWriteEvent);
tv_eternity(&rep->wex);
shutdown(t->cli_fd, SHUT_WR);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->cli_fd, StaticReadEvent);
+ MY_FD_SET(t->cli_fd, StaticReadEvent);
if (t->proxy->clitimeout)
tv_delayfrom(&req->rex, &now, t->proxy->clitimeout);
if (req->l >= req->rlim - req->data) {
/* no room to read more data */
- if (FD_ISSET(t->cli_fd, StaticReadEvent)) {
+ if (MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
/* stop reading until we get some space */
- FD_CLR(t->cli_fd, StaticReadEvent);
+ MY_FD_CLR(t->cli_fd, StaticReadEvent);
tv_eternity(&req->rex);
}
} else {
/* there's still some space in the buffer */
- if (! FD_ISSET(t->cli_fd, StaticReadEvent)) {
- FD_SET(t->cli_fd, StaticReadEvent);
+ if (! MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
+ MY_FD_SET(t->cli_fd, StaticReadEvent);
if (!t->proxy->clitimeout ||
(t->srv_state < SV_STDATA && t->proxy->srvtimeout))
/* If the client has no timeout, or if the server not ready yet, and we
if ((rep->l == 0) ||
((s < SV_STDATA) /* FIXME: this may be optimized && (rep->w == rep->h)*/)) {
- if (FD_ISSET(t->cli_fd, StaticWriteEvent)) {
- FD_CLR(t->cli_fd, StaticWriteEvent); /* stop writing */
+ if (MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
+ MY_FD_CLR(t->cli_fd, StaticWriteEvent); /* stop writing */
tv_eternity(&rep->wex);
}
} else {
/* buffer not empty */
- if (! FD_ISSET(t->cli_fd, StaticWriteEvent)) {
- FD_SET(t->cli_fd, StaticWriteEvent); /* restart writing */
+ if (! MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
+ MY_FD_SET(t->cli_fd, StaticWriteEvent); /* restart writing */
if (t->proxy->clitimeout) {
tv_delayfrom(&rep->wex, &now, t->proxy->clitimeout);
/* FIXME: to prevent the client from expiring read timeouts during writes,
if ((rep->l == 0)
|| ((s == SV_STHEADERS) /* FIXME: this may be optimized && (rep->w == rep->h)*/)) {
- if (FD_ISSET(t->cli_fd, StaticWriteEvent)) {
- FD_CLR(t->cli_fd, StaticWriteEvent); /* stop writing */
+ if (MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
+ MY_FD_CLR(t->cli_fd, StaticWriteEvent); /* stop writing */
tv_eternity(&rep->wex);
}
} else {
/* buffer not empty */
- if (! FD_ISSET(t->cli_fd, StaticWriteEvent)) {
- FD_SET(t->cli_fd, StaticWriteEvent); /* restart writing */
+ if (! MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
+ MY_FD_SET(t->cli_fd, StaticWriteEvent); /* restart writing */
if (t->proxy->clitimeout) {
tv_delayfrom(&rep->wex, &now, t->proxy->clitimeout);
/* FIXME: to prevent the client from expiring read timeouts during writes,
* after the timeout by sending more data after it receives a close ?
*/
- if (FD_ISSET(t->cli_fd, StaticReadEvent)) {
+ if (MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
/* stop reading until we get some space */
- FD_CLR(t->cli_fd, StaticReadEvent);
+ MY_FD_CLR(t->cli_fd, StaticReadEvent);
tv_eternity(&req->rex);
//fprintf(stderr,"%p:%s(%d), c=%d, s=%d\n", t, __FUNCTION__, __LINE__, t->cli_state, t->cli_state);
}
} else {
/* there's still some space in the buffer */
- if (! FD_ISSET(t->cli_fd, StaticReadEvent)) {
- FD_SET(t->cli_fd, StaticReadEvent);
+ if (! MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
+ MY_FD_SET(t->cli_fd, StaticReadEvent);
if (t->proxy->clitimeout)
tv_delayfrom(&req->rex, &now, t->proxy->clitimeout);
else
fprintf(stderr,"process_srv: c=%s, s=%s\n", cli_stnames[c], srv_stnames[s]);
#endif
//fprintf(stderr,"process_srv: c=%d, s=%d, cr=%d, cw=%d, sr=%d, sw=%d\n", c, s,
- //FD_ISSET(t->cli_fd, StaticReadEvent), FD_ISSET(t->cli_fd, StaticWriteEvent),
- //FD_ISSET(t->srv_fd, StaticReadEvent), FD_ISSET(t->srv_fd, StaticWriteEvent)
+ //MY_FD_ISSET(t->cli_fd, StaticReadEvent), MY_FD_ISSET(t->cli_fd, StaticWriteEvent),
+ //MY_FD_ISSET(t->srv_fd, StaticReadEvent), MY_FD_ISSET(t->srv_fd, StaticWriteEvent)
//);
if (s == SV_STIDLE) {
if (c == CL_STHEADERS)
//fprintf(stderr,"3: c=%d, s=%d\n", c, s);
if (req->l == 0) /* nothing to write */ {
- FD_CLR(t->srv_fd, StaticWriteEvent);
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
} else /* need the right to write */ {
- FD_SET(t->srv_fd, StaticWriteEvent);
+ MY_FD_SET(t->srv_fd, StaticWriteEvent);
if (t->proxy->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->proxy->srvtimeout);
/* FIXME: to prevent the server from expiring read timeouts during writes,
}
if (t->proxy->mode == PR_MODE_TCP) { /* let's allow immediate data connection in this case */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
else
*/
if ((req->l == 0) &&
(c == CL_STSHUTR || c == CL_STCLOSE || t->proxy->options & PR_O_FORCE_CLO)) {
- FD_CLR(t->srv_fd, StaticWriteEvent);
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
/* end of header processing (even if incomplete) */
- if ((rep->l < rep->rlim - rep->data) && ! FD_ISSET(t->srv_fd, StaticReadEvent)) {
+ if ((rep->l < rep->rlim - rep->data) && ! MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
/* fd in StaticReadEvent was disabled, perhaps because of a previous buffer
* full. We cannot loop here since stream_sock_read will disable it only if
* rep->l == rlim-data
*/
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
else
* won't be able to free more later, so the session will never terminate.
*/
else if (rep->flags & BF_READ_NULL || c == CL_STSHUTW || c == CL_STCLOSE || rep->l >= rep->rlim - rep->data) {
- FD_CLR(t->srv_fd, StaticReadEvent);
+ MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
shutdown(t->srv_fd, SHUT_RD);
t->srv_state = SV_STSHUTR;
}
/* read timeout : return a 504 to the client.
*/
- else if (FD_ISSET(t->srv_fd, StaticReadEvent) && tv_cmp2_ms(&rep->rex, &now) <= 0) {
+ else if (MY_FD_ISSET(t->srv_fd, StaticReadEvent) && tv_cmp2_ms(&rep->rex, &now) <= 0) {
tv_eternity(&rep->rex);
tv_eternity(&req->wex);
fd_delete(t->srv_fd);
* is kept until a response comes back or the timeout is reached.
*/
else if ((/*c == CL_STSHUTR ||*/ c == CL_STCLOSE) && (req->l == 0)) {
- FD_CLR(t->srv_fd, StaticWriteEvent);
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
* client shuts read too early, because we may still have
* some work to do on the headers.
*/
- else if (FD_ISSET(t->srv_fd, StaticWriteEvent) && tv_cmp2_ms(&req->wex, &now) <= 0) {
- FD_CLR(t->srv_fd, StaticWriteEvent);
+ else if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent) && tv_cmp2_ms(&req->wex, &now) <= 0) {
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
shutdown(t->srv_fd, SHUT_WR);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
}
if (req->l == 0) {
- if (FD_ISSET(t->srv_fd, StaticWriteEvent)) {
- FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
+ if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
tv_eternity(&req->wex);
}
}
else { /* client buffer not empty */
- if (! FD_ISSET(t->srv_fd, StaticWriteEvent)) {
- FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
+ if (! MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
+ MY_FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
if (t->proxy->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->proxy->srvtimeout);
/* FIXME: to prevent the server from expiring read timeouts during writes,
}
/* last read, or end of client write */
else if (rep->flags & BF_READ_NULL || c == CL_STSHUTW || c == CL_STCLOSE) {
- FD_CLR(t->srv_fd, StaticReadEvent);
+ MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
shutdown(t->srv_fd, SHUT_RD);
t->srv_state = SV_STSHUTR;
}
/* end of client read and no more data to send */
else if ((c == CL_STSHUTR || c == CL_STCLOSE) && (req->l == 0)) {
- FD_CLR(t->srv_fd, StaticWriteEvent);
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
shutdown(t->srv_fd, SHUT_WR);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
}
/* read timeout */
else if (tv_cmp2_ms(&rep->rex, &now) <= 0) {
- FD_CLR(t->srv_fd, StaticReadEvent);
+ MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
shutdown(t->srv_fd, SHUT_RD);
t->srv_state = SV_STSHUTR;
}
/* write timeout */
else if (tv_cmp2_ms(&req->wex, &now) <= 0) {
- FD_CLR(t->srv_fd, StaticWriteEvent);
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
shutdown(t->srv_fd, SHUT_WR);
/* We must ensure that the read part is still alive when switching
* to shutw */
- FD_SET(t->srv_fd, StaticReadEvent);
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
t->srv_state = SV_STSHUTW;
/* recompute request time-outs */
if (req->l == 0) {
- if (FD_ISSET(t->srv_fd, StaticWriteEvent)) {
- FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
+ if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
tv_eternity(&req->wex);
}
}
else { /* buffer not empty, there are still data to be transferred */
- if (! FD_ISSET(t->srv_fd, StaticWriteEvent)) {
- FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
+ if (! MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
+ MY_FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
if (t->proxy->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->proxy->srvtimeout);
/* FIXME: to prevent the server from expiring read timeouts during writes,
/* recompute response time-outs */
if (rep->l == BUFSIZE) { /* no room to read more data */
- if (FD_ISSET(t->srv_fd, StaticReadEvent)) {
- FD_CLR(t->srv_fd, StaticReadEvent);
+ if (MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
+ MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
}
}
else {
- if (! FD_ISSET(t->srv_fd, StaticReadEvent)) {
- FD_SET(t->srv_fd, StaticReadEvent);
+ if (! MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
else
}
else if (s == SV_STSHUTR) {
if (req->flags & BF_WRITE_ERROR) {
- //FD_CLR(t->srv_fd, StaticWriteEvent);
+ //MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
fd_delete(t->srv_fd);
if (t->srv) {
return 1;
}
else if ((c == CL_STSHUTR || c == CL_STCLOSE) && (req->l == 0)) {
- //FD_CLR(t->srv_fd, StaticWriteEvent);
+ //MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
fd_delete(t->srv_fd);
if (t->srv)
return 1;
}
else if (tv_cmp2_ms(&req->wex, &now) <= 0) {
- //FD_CLR(t->srv_fd, StaticWriteEvent);
+ //MY_FD_CLR(t->srv_fd, StaticWriteEvent);
tv_eternity(&req->wex);
fd_delete(t->srv_fd);
if (t->srv)
return 1;
}
else if (req->l == 0) {
- if (FD_ISSET(t->srv_fd, StaticWriteEvent)) {
- FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
+ if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
+ MY_FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
tv_eternity(&req->wex);
}
}
else { /* buffer not empty */
- if (! FD_ISSET(t->srv_fd, StaticWriteEvent)) {
- FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
+ if (! MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
+ MY_FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
if (t->proxy->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->proxy->srvtimeout);
/* FIXME: to prevent the server from expiring read timeouts during writes,
}
else if (s == SV_STSHUTW) {
if (rep->flags & BF_READ_ERROR) {
- //FD_CLR(t->srv_fd, StaticReadEvent);
+ //MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
fd_delete(t->srv_fd);
if (t->srv) {
return 1;
}
else if (rep->flags & BF_READ_NULL || c == CL_STSHUTW || c == CL_STCLOSE) {
- //FD_CLR(t->srv_fd, StaticReadEvent);
+ //MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
fd_delete(t->srv_fd);
if (t->srv)
return 1;
}
else if (tv_cmp2_ms(&rep->rex, &now) <= 0) {
- //FD_CLR(t->srv_fd, StaticReadEvent);
+ //MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
fd_delete(t->srv_fd);
if (t->srv)
return 1;
}
else if (rep->l == BUFSIZE) { /* no room to read more data */
- if (FD_ISSET(t->srv_fd, StaticReadEvent)) {
- FD_CLR(t->srv_fd, StaticReadEvent);
+ if (MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
+ MY_FD_CLR(t->srv_fd, StaticReadEvent);
tv_eternity(&rep->rex);
}
}
else {
- if (! FD_ISSET(t->srv_fd, StaticReadEvent)) {
- FD_SET(t->srv_fd, StaticReadEvent);
+ if (! MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
+ MY_FD_SET(t->srv_fd, StaticReadEvent);
if (t->proxy->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->proxy->srvtimeout);
else