}
/* 4: do we need to re-enable the read socket ? */
- else if (unlikely(! EV_FD_ISSET(t->cli_fd, DIR_RD))) {
+ else if (unlikely(EV_FD_COND_S(t->cli_fd, DIR_RD))) {
/* fd in DIR_RD 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
*/
- EV_FD_SET(t->cli_fd, DIR_RD);
if (t->fe->clitimeout)
tv_delayfrom(&req->rex, &now, t->fe->clitimeout);
else
if (req->l >= req->rlim - req->data) {
/* no room to read more data */
- if (EV_FD_ISSET(t->cli_fd, DIR_RD)) {
+ if (EV_FD_COND_C(t->cli_fd, DIR_RD)) {
/* stop reading until we get some space */
- EV_FD_CLR(t->cli_fd, DIR_RD);
tv_eternity(&req->rex);
}
} else {
/* there's still some space in the buffer */
- if (! EV_FD_ISSET(t->cli_fd, DIR_RD)) {
- EV_FD_SET(t->cli_fd, DIR_RD);
+ if (EV_FD_COND_S(t->cli_fd, DIR_RD)) {
if (!t->fe->clitimeout ||
(t->srv_state < SV_STDATA && t->be->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 (EV_FD_ISSET(t->cli_fd, DIR_WR)) {
- EV_FD_CLR(t->cli_fd, DIR_WR); /* stop writing */
+ if (EV_FD_COND_C(t->cli_fd, DIR_WR)) {
+ /* stop writing */
tv_eternity(&rep->wex);
}
} else {
/* buffer not empty */
- if (! EV_FD_ISSET(t->cli_fd, DIR_WR)) {
- EV_FD_SET(t->cli_fd, DIR_WR); /* restart writing */
+ if (EV_FD_COND_S(t->cli_fd, DIR_WR)) {
+ /* restart writing */
if (t->fe->clitimeout) {
tv_delayfrom(&rep->wex, &now, t->fe->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 (EV_FD_ISSET(t->cli_fd, DIR_WR)) {
- EV_FD_CLR(t->cli_fd, DIR_WR); /* stop writing */
+ if (EV_FD_COND_C(t->cli_fd, DIR_WR)) {
+ /* stop writing */
tv_eternity(&rep->wex);
}
} else {
/* buffer not empty */
- if (! EV_FD_ISSET(t->cli_fd, DIR_WR)) {
- EV_FD_SET(t->cli_fd, DIR_WR); /* restart writing */
+ if (EV_FD_COND_S(t->cli_fd, DIR_WR)) {
+ /* restart writing */
if (t->fe->clitimeout) {
tv_delayfrom(&rep->wex, &now, t->fe->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 (EV_FD_ISSET(t->cli_fd, DIR_RD)) {
+ if (EV_FD_COND_C(t->cli_fd, DIR_RD)) {
/* stop reading until we get some space */
- EV_FD_CLR(t->cli_fd, DIR_RD);
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 (! EV_FD_ISSET(t->cli_fd, DIR_RD)) {
- EV_FD_SET(t->cli_fd, DIR_RD);
+ if (EV_FD_COND_S(t->cli_fd, DIR_RD)) {
if (t->fe->clitimeout)
tv_delayfrom(&req->rex, &now, t->fe->clitimeout);
else
}
- if ((rep->l < rep->rlim - rep->data) && ! EV_FD_ISSET(t->srv_fd, DIR_RD)) {
+ if ((rep->l < rep->rlim - rep->data) && EV_FD_COND_S(t->srv_fd, DIR_RD)) {
/* fd in DIR_RD 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
*/
- EV_FD_SET(t->srv_fd, DIR_RD);
if (t->be->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
else
* some work to do on the headers.
*/
else if (unlikely(EV_FD_ISSET(t->srv_fd, DIR_WR) &&
- tv_cmp2_ms(&req->wex, &now) <= 0)) {
+ tv_cmp2_ms(&req->wex, &now) <= 0)) {
EV_FD_CLR(t->srv_fd, DIR_WR);
tv_eternity(&req->wex);
shutdown(t->srv_fd, SHUT_WR);
* long posts.
*/
else if (likely(req->l)) {
- if (! EV_FD_ISSET(t->srv_fd, DIR_WR)) {
- EV_FD_SET(t->srv_fd, DIR_WR); /* restart writing */
+ if (EV_FD_COND_S(t->srv_fd, DIR_WR)) {
+ /* restart writing */
if (t->be->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->be->srvtimeout);
/* FIXME: to prevent the server from expiring read timeouts during writes,
/* nothing left in the request buffer */
else {
- if (EV_FD_ISSET(t->srv_fd, DIR_WR)) {
- EV_FD_CLR(t->srv_fd, DIR_WR); /* stop writing */
+ if (EV_FD_COND_C(t->srv_fd, DIR_WR)) {
+ /* stop writing */
tv_eternity(&req->wex);
}
}
/* recompute request time-outs */
if (req->l == 0) {
- if (EV_FD_ISSET(t->srv_fd, DIR_WR)) {
- EV_FD_CLR(t->srv_fd, DIR_WR); /* stop writing */
+ if (EV_FD_COND_C(t->srv_fd, DIR_WR)) {
+ /* stop writing */
tv_eternity(&req->wex);
}
}
else { /* buffer not empty, there are still data to be transferred */
- if (! EV_FD_ISSET(t->srv_fd, DIR_WR)) {
- EV_FD_SET(t->srv_fd, DIR_WR); /* restart writing */
+ if (EV_FD_COND_S(t->srv_fd, DIR_WR)) {
+ /* restart writing */
if (t->be->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->be->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 (EV_FD_ISSET(t->srv_fd, DIR_RD)) {
- EV_FD_CLR(t->srv_fd, DIR_RD);
+ if (EV_FD_COND_C(t->srv_fd, DIR_RD)) {
tv_eternity(&rep->rex);
}
}
else {
- if (! EV_FD_ISSET(t->srv_fd, DIR_RD)) {
- EV_FD_SET(t->srv_fd, DIR_RD);
+ if (EV_FD_COND_S(t->srv_fd, DIR_RD)) {
if (t->be->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
else
return 1;
}
else if (req->l == 0) {
- if (EV_FD_ISSET(t->srv_fd, DIR_WR)) {
- EV_FD_CLR(t->srv_fd, DIR_WR); /* stop writing */
+ if (EV_FD_COND_C(t->srv_fd, DIR_WR)) {
+ /* stop writing */
tv_eternity(&req->wex);
}
}
else { /* buffer not empty */
- if (! EV_FD_ISSET(t->srv_fd, DIR_WR)) {
- EV_FD_SET(t->srv_fd, DIR_WR); /* restart writing */
+ if (EV_FD_COND_S(t->srv_fd, DIR_WR)) {
+ /* restart writing */
if (t->be->srvtimeout) {
tv_delayfrom(&req->wex, &now, t->be->srvtimeout);
/* FIXME: to prevent the server from expiring read timeouts during writes,
return 1;
}
else if (rep->l == BUFSIZE) { /* no room to read more data */
- if (EV_FD_ISSET(t->srv_fd, DIR_RD)) {
- EV_FD_CLR(t->srv_fd, DIR_RD);
+ if (EV_FD_COND_C(t->srv_fd, DIR_RD)) {
tv_eternity(&rep->rex);
}
}
else {
- if (! EV_FD_ISSET(t->srv_fd, DIR_RD)) {
- EV_FD_SET(t->srv_fd, DIR_RD);
+ if (EV_FD_COND_S(t->srv_fd, DIR_RD)) {
if (t->be->srvtimeout)
tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
else