]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] updated all files to use EV_FD_*
authorWilly Tarreau <w@1wt.eu>
Sun, 8 Apr 2007 14:59:42 +0000 (16:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 8 Apr 2007 14:59:42 +0000 (16:59 +0200)
Removed the temporary dirty hack.

include/proto/fd.h
src/backend.c
src/checks.c
src/client.c
src/haproxy.c
src/proto_http.c
src/proxy.c
src/stream_sock.c

index 03a7add8e21251ac2ce59f0610d33a701f7ad2c7..be5261248e61d95babd1842e4aa56cdc73ad95f1 100644 (file)
@@ -51,22 +51,11 @@ int init_pollers();
  */
 void run_poller();
 
-
-/* FIXME: dirty hack during code transition */
-#define dir_StaticWriteEvent DIR_WR
-#define dir_StaticReadEvent DIR_RD
-#define dir_DIR_RD DIR_RD
-#define dir_DIR_WR DIR_WR
-
-#define MY_FD_SET(fd, ev) (cur_poller.set((fd), dir_##ev))
-#define MY_FD_CLR(fd, ev) (cur_poller.clr((fd), dir_##ev))
-#define MY_FD_ISSET(fd, ev) (cur_poller.isset((fd), dir_##ev))
-
-#define EV_FD_SET(fd, ev)    (cur_poller.set((fd), dir_##ev))
-#define EV_FD_CLR(fd, ev)    (cur_poller.clr((fd), dir_##ev))
-#define EV_FD_ISSET(fd, ev)  (cur_poller.isset((fd), dir_##ev))
-#define EV_FD_COND_S(fd, ev) (cur_poller.cond_s((fd), dir_##ev))
-#define EV_FD_COND_C(fd, ev) (cur_poller.cond_c((fd), dir_##ev))
+#define EV_FD_SET(fd, ev)    (cur_poller.set((fd), (ev)))
+#define EV_FD_CLR(fd, ev)    (cur_poller.clr((fd), (ev)))
+#define EV_FD_ISSET(fd, ev)  (cur_poller.isset((fd), (ev)))
+#define EV_FD_COND_S(fd, ev) (cur_poller.cond_s((fd), (ev)))
+#define EV_FD_COND_C(fd, ev) (cur_poller.cond_c((fd), (ev)))
 #define EV_FD_REM(fd)        (cur_poller.rem(fd))
 #define EV_FD_CLO(fd)        (cur_poller.clo(fd))
 
index ff024439288e951a93efbf12da96c96abbbe767a..0eb97ed066526b35f224d050b432a5f73f3bcecb 100644 (file)
@@ -532,13 +532,7 @@ int connect_server(struct session *s)
        fdtab[fd].cb[DIR_WR].f = &stream_sock_write;
        fdtab[fd].cb[DIR_WR].b = s->req;
     
-       MY_FD_SET(fd, StaticWriteEvent);  /* for connect status */
-#if defined(DEBUG_FULL) && defined(ENABLE_EPOLL)
-       if (PrevReadEvent) {
-               assert(!(MY_FD_ISSET(fd, PrevReadEvent)));
-               assert(!(MY_FD_ISSET(fd, PrevWriteEvent)));
-       }
-#endif
+       EV_FD_SET(fd, DIR_WR);  /* for connect status */
     
        fd_insert(fd);
        if (s->srv) {
index 456d7a3931c81e7eeaf3290874068e17a9c48be2..0a272018d4aa04223e03174b1bfdd618aecc1f15 100644 (file)
@@ -118,7 +118,7 @@ int event_srv_chk_w(int fd)
                /* in case of TCP only, this tells us if the connection failed */
                s->result = -1;
                fdtab[fd].state = FD_STERROR;
-               MY_FD_CLR(fd, StaticWriteEvent);
+               EV_FD_CLR(fd, DIR_WR);
        }
        else if (s->result != -1) {
                /* we don't want to mark 'UP' a server on which we detected an error earlier */
@@ -141,13 +141,13 @@ int event_srv_chk_w(int fd)
                        ret = send(fd, s->proxy->check_req, s->proxy->check_len, MSG_DONTWAIT | MSG_NOSIGNAL);
 #endif
                        if (ret == s->proxy->check_len) {
-                               MY_FD_SET(fd, StaticReadEvent);   /* prepare for reading reply */
-                               MY_FD_CLR(fd, StaticWriteEvent);  /* nothing more to write */
+                               EV_FD_SET(fd, DIR_RD);   /* prepare for reading reply */
+                               EV_FD_CLR(fd, DIR_WR);   /* nothing more to write */
                                return 0;
                        }
                        else {
                                s->result = -1;
-                               MY_FD_CLR(fd, StaticWriteEvent);
+                               EV_FD_CLR(fd, DIR_WR);
                        }
                }
                else {
@@ -204,7 +204,7 @@ int event_srv_chk_r(int fd)
        if (s->result != -1)
                s->result = result;
 
-       MY_FD_CLR(fd, StaticReadEvent);
+       EV_FD_CLR(fd, DIR_RD);
        task_wakeup(&rq, t);
        return 0;
 }
@@ -335,9 +335,9 @@ int process_chk(struct task *t)
                                                fdtab[fd].cb[DIR_WR].f = &event_srv_chk_w;
                                                fdtab[fd].cb[DIR_WR].b = NULL;
                                                fdtab[fd].state = FD_STCONN; /* connection in progress */
-                                               MY_FD_SET(fd, StaticWriteEvent);  /* for connect status */
+                                               EV_FD_SET(fd, DIR_WR);  /* for connect status */
 #ifdef DEBUG_FULL
-                                               assert (!MY_FD_ISSET(fd, StaticReadEvent));
+                                               assert (!EV_FD_ISSET(fd, DIR_RD));
 #endif
                                                fd_insert(fd);
                                                /* FIXME: we allow up to <inter> for a connection to establish, but we should use another parameter */
@@ -420,7 +420,6 @@ int process_chk(struct task *t)
                                s->health = s->rise + s->fall - 1; /* OK now */
                        }
                        s->curfd = -1; /* no check running anymore */
-                       //MY_FD_CLR(fd, StaticWriteEvent);
                        fd_delete(fd);
                        while (tv_cmp2_ms(&t->expire, &now) <= 0)
                                tv_delayfrom(&t->expire, &t->expire, s->inter);
@@ -436,7 +435,6 @@ int process_chk(struct task *t)
                        else
                                set_server_down(s);
                        s->curfd = -1;
-                       //MY_FD_CLR(fd, StaticWriteEvent);
                        fd_delete(fd);
                        while (tv_cmp2_ms(&t->expire, &now) <= 0)
                                tv_delayfrom(&t->expire, &t->expire, s->inter);
index de8280bd0657829aa607ec2fa5a975e3a419f449..6b27df60f3d92cf2303bfa07612250bd8ea51b40 100644 (file)
@@ -99,7 +99,7 @@ int event_accept(int fd) {
 
                if ((s = pool_alloc(session)) == NULL) { /* disable this proxy for a while */
                        Alert("out of memory in event_accept().\n");
-                       MY_FD_CLR(fd, StaticReadEvent);
+                       EV_FD_CLR(fd, DIR_RD);
                        p->state = PR_STIDLE;
                        close(cfd);
                        return 0;
@@ -122,7 +122,7 @@ int event_accept(int fd) {
 
                if ((t = pool_alloc(task)) == NULL) { /* disable this proxy for a while */
                        Alert("out of memory in event_accept().\n");
-                       MY_FD_CLR(fd, StaticReadEvent);
+                       EV_FD_CLR(fd, DIR_RD);
                        p->state = PR_STIDLE;
                        close(cfd);
                        pool_free(session, s);
@@ -399,15 +399,9 @@ int event_accept(int fd) {
                        client_retnclose(s, &msg); /* forge an "OK" response */
                }
                else {
-                       MY_FD_SET(cfd, StaticReadEvent);
+                       EV_FD_SET(cfd, DIR_RD);
                }
 
-#if defined(DEBUG_FULL) && defined(ENABLE_EPOLL)
-               if (PrevReadEvent) {
-                       assert(!(MY_FD_ISSET(cfd, PrevReadEvent)));
-                       assert(!(MY_FD_ISSET(cfd, PrevWriteEvent)));
-               }
-#endif
                fd_insert(cfd);
 
                tv_eternity(&s->req->rex);
@@ -417,9 +411,9 @@ int event_accept(int fd) {
                tv_eternity(&s->rep->wex);
 
                if (s->fe->clitimeout) {
-                       if (MY_FD_ISSET(cfd, StaticReadEvent))
+                       if (EV_FD_ISSET(cfd, DIR_RD))
                                tv_delayfrom(&s->req->rex, &now, s->fe->clitimeout);
-                       if (MY_FD_ISSET(cfd, StaticWriteEvent))
+                       if (EV_FD_ISSET(cfd, DIR_WR))
                                tv_delayfrom(&s->rep->wex, &now, s->fe->clitimeout);
                }
 
index 7b23e2fa51860e6fb99b20ead70e9711dc1f6432..bafff4bfb1ed61f555192136e4579c5c70adafa9 100644 (file)
@@ -277,10 +277,10 @@ void dump(int sig)
                         s, tv_remain(&now, &t->expire),
                         s->cli_state,
                         s->srv_state,
-                        MY_FD_ISSET(s->cli_fd, StaticReadEvent),
-                        MY_FD_ISSET(s->cli_fd, StaticWriteEvent),
-                        MY_FD_ISSET(s->srv_fd, StaticReadEvent),
-                        MY_FD_ISSET(s->srv_fd, StaticWriteEvent),
+                        EV_FD_ISSET(s->cli_fd, DIR_RD),
+                        EV_FD_ISSET(s->cli_fd, DIR_WR),
+                        EV_FD_ISSET(s->srv_fd, DIR_RD),
+                        EV_FD_ISSET(s->srv_fd, DIR_WR),
                         s->req->l, s->rep?s->rep->l:0, s->cli_fd
                         );
        }
index 38b2db02c74e71adcbf4b6e810508a6a58778459..6a2cc0b3f951beece80739d79895ce677f6d845f 100644 (file)
@@ -437,8 +437,8 @@ int http_header_match2(const char *hdr, const char *end,
  */
 void client_retnclose(struct session *s, const struct chunk *msg)
 {
-       MY_FD_CLR(s->cli_fd, StaticReadEvent);
-       MY_FD_SET(s->cli_fd, StaticWriteEvent);
+       EV_FD_CLR(s->cli_fd, DIR_RD);
+       EV_FD_SET(s->cli_fd, DIR_WR);
        tv_eternity(&s->req->rex);
        if (s->fe->clitimeout)
                tv_delayfrom(&s->rep->wex, &now, s->fe->clitimeout);
@@ -1433,7 +1433,7 @@ int process_cli(struct session *t)
 
        DPRINTF(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],
-               MY_FD_ISSET(t->cli_fd, StaticReadEvent), MY_FD_ISSET(t->cli_fd, StaticWriteEvent),
+               EV_FD_ISSET(t->cli_fd, DIR_RD), EV_FD_ISSET(t->cli_fd, DIR_WR),
                req->rex.tv_sec, req->rex.tv_usec,
                rep->wex.tv_sec, rep->wex.tv_usec);
 
@@ -1540,12 +1540,12 @@ int process_cli(struct session *t)
                        }
 
                        /* 4: do we need to re-enable the read socket ? */
-                       else if (unlikely(! MY_FD_ISSET(t->cli_fd, StaticReadEvent))) {
-                               /* fd in StaticReadEvent was disabled, perhaps because of a previous buffer
+                       else if (unlikely(! EV_FD_ISSET(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
                                 */
-                               MY_FD_SET(t->cli_fd, StaticReadEvent);
+                               EV_FD_SET(t->cli_fd, DIR_RD);
                                if (t->fe->clitimeout)
                                        tv_delayfrom(&req->rex, &now, t->fe->clitimeout);
                                else
@@ -1963,7 +1963,7 @@ int process_cli(struct session *t)
                }
                /* last read, or end of server write */
                else if (req->flags & BF_READ_NULL || s == SV_STSHUTW || s == SV_STCLOSE) {
-                       MY_FD_CLR(t->cli_fd, StaticReadEvent);
+                       EV_FD_CLR(t->cli_fd, DIR_RD);
                        tv_eternity(&req->rex);
                        shutdown(t->cli_fd, SHUT_RD);
                        t->cli_state = CL_STSHUTR;
@@ -1971,12 +1971,12 @@ int process_cli(struct session *t)
                }       
                /* last server read and buffer empty */
                else if ((s == SV_STSHUTR || s == SV_STCLOSE) && (rep->l == 0)) {
-                       MY_FD_CLR(t->cli_fd, StaticWriteEvent);
+                       EV_FD_CLR(t->cli_fd, DIR_WR);
                        tv_eternity(&rep->wex);
                        shutdown(t->cli_fd, SHUT_WR);
                        /* We must ensure that the read part is still alive when switching
                         * to shutw */
-                       MY_FD_SET(t->cli_fd, StaticReadEvent);
+                       EV_FD_SET(t->cli_fd, DIR_RD);
                        if (t->fe->clitimeout)
                                tv_delayfrom(&req->rex, &now, t->fe->clitimeout);
                        t->cli_state = CL_STSHUTW;
@@ -1985,7 +1985,7 @@ int process_cli(struct session *t)
                }
                /* read timeout */
                else if (tv_cmp2_ms(&req->rex, &now) <= 0) {
-                       MY_FD_CLR(t->cli_fd, StaticReadEvent);
+                       EV_FD_CLR(t->cli_fd, DIR_RD);
                        tv_eternity(&req->rex);
                        shutdown(t->cli_fd, SHUT_RD);
                        t->cli_state = CL_STSHUTR;
@@ -2003,12 +2003,12 @@ int process_cli(struct session *t)
                }       
                /* write timeout */
                else if (tv_cmp2_ms(&rep->wex, &now) <= 0) {
-                       MY_FD_CLR(t->cli_fd, StaticWriteEvent);
+                       EV_FD_CLR(t->cli_fd, DIR_WR);
                        tv_eternity(&rep->wex);
                        shutdown(t->cli_fd, SHUT_WR);
                        /* We must ensure that the read part is still alive when switching
                         * to shutw */
-                       MY_FD_SET(t->cli_fd, StaticReadEvent);
+                       EV_FD_SET(t->cli_fd, DIR_RD);
                        if (t->fe->clitimeout)
                                tv_delayfrom(&req->rex, &now, t->fe->clitimeout);
 
@@ -2028,15 +2028,15 @@ int process_cli(struct session *t)
 
                if (req->l >= req->rlim - req->data) {
                        /* no room to read more data */
-                       if (MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
+                       if (EV_FD_ISSET(t->cli_fd, DIR_RD)) {
                                /* stop reading until we get some space */
-                               MY_FD_CLR(t->cli_fd, StaticReadEvent);
+                               EV_FD_CLR(t->cli_fd, DIR_RD);
                                tv_eternity(&req->rex);
                        }
                } else {
                        /* there's still some space in the buffer */
-                       if (! MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
-                               MY_FD_SET(t->cli_fd, StaticReadEvent);
+                       if (! EV_FD_ISSET(t->cli_fd, DIR_RD)) {
+                               EV_FD_SET(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
@@ -2052,14 +2052,14 @@ int process_cli(struct session *t)
 
                if ((rep->l == 0) ||
                    ((s < SV_STDATA) /* FIXME: this may be optimized && (rep->w == rep->h)*/)) {
-                       if (MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
-                               MY_FD_CLR(t->cli_fd, StaticWriteEvent); /* stop writing */
+                       if (EV_FD_ISSET(t->cli_fd, DIR_WR)) {
+                               EV_FD_CLR(t->cli_fd, DIR_WR); /* stop writing */
                                tv_eternity(&rep->wex);
                        }
                } else {
                        /* buffer not empty */
-                       if (! MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
-                               MY_FD_SET(t->cli_fd, StaticWriteEvent); /* restart writing */
+                       if (! EV_FD_ISSET(t->cli_fd, DIR_WR)) {
+                               EV_FD_SET(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,
@@ -2125,14 +2125,14 @@ int process_cli(struct session *t)
 
                if ((rep->l == 0)
                    || ((s == SV_STHEADERS) /* FIXME: this may be optimized && (rep->w == rep->h)*/)) {
-                       if (MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
-                               MY_FD_CLR(t->cli_fd, StaticWriteEvent); /* stop writing */
+                       if (EV_FD_ISSET(t->cli_fd, DIR_WR)) {
+                               EV_FD_CLR(t->cli_fd, DIR_WR); /* stop writing */
                                tv_eternity(&rep->wex);
                        }
                } else {
                        /* buffer not empty */
-                       if (! MY_FD_ISSET(t->cli_fd, StaticWriteEvent)) {
-                               MY_FD_SET(t->cli_fd, StaticWriteEvent); /* restart writing */
+                       if (! EV_FD_ISSET(t->cli_fd, DIR_WR)) {
+                               EV_FD_SET(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,
@@ -2191,16 +2191,16 @@ int process_cli(struct session *t)
                         * after the timeout by sending more data after it receives a close ?
                         */
 
-                       if (MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
+                       if (EV_FD_ISSET(t->cli_fd, DIR_RD)) {
                                /* stop reading until we get some space */
-                               MY_FD_CLR(t->cli_fd, StaticReadEvent);
+                               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 (! MY_FD_ISSET(t->cli_fd, StaticReadEvent)) {
-                               MY_FD_SET(t->cli_fd, StaticReadEvent);
+                       if (! EV_FD_ISSET(t->cli_fd, DIR_RD)) {
+                               EV_FD_SET(t->cli_fd, DIR_RD);
                                if (t->fe->clitimeout)
                                        tv_delayfrom(&req->rex, &now, t->fe->clitimeout);
                                else
@@ -2239,8 +2239,8 @@ int process_srv(struct session *t)
        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,
-       //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)
+       //EV_FD_ISSET(t->cli_fd, DIR_RD), EV_FD_ISSET(t->cli_fd, DIR_WR),
+       //EV_FD_ISSET(t->srv_fd, DIR_RD), EV_FD_ISSET(t->srv_fd, DIR_WR)
        //);
        if (s == SV_STIDLE) {
                if (c == CL_STHEADERS)
@@ -2397,10 +2397,10 @@ int process_srv(struct session *t)
 
                        //fprintf(stderr,"3: c=%d, s=%d\n", c, s);
                        if (req->l == 0) /* nothing to write */ {
-                               MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                               EV_FD_CLR(t->srv_fd, DIR_WR);
                                tv_eternity(&req->wex);
                        } else  /* need the right to write */ {
-                               MY_FD_SET(t->srv_fd, StaticWriteEvent);
+                               EV_FD_SET(t->srv_fd, DIR_WR);
                                if (t->be->srvtimeout) {
                                        tv_delayfrom(&req->wex, &now, t->be->srvtimeout);
                                        /* FIXME: to prevent the server from expiring read timeouts during writes,
@@ -2412,7 +2412,7 @@ int process_srv(struct session *t)
                        }
 
                        if (t->be->mode == PR_MODE_TCP) { /* let's allow immediate data connection in this case */
-                               MY_FD_SET(t->srv_fd, StaticReadEvent);
+                               EV_FD_SET(t->srv_fd, DIR_RD);
                                if (t->be->srvtimeout)
                                        tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
                                else
@@ -2497,12 +2497,12 @@ int process_srv(struct session *t)
                }
 
 
-               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
+               if ((rep->l < rep->rlim - rep->data) && ! EV_FD_ISSET(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
                         */
-                       MY_FD_SET(t->srv_fd, StaticReadEvent);
+                       EV_FD_SET(t->srv_fd, DIR_RD);
                        if (t->be->srvtimeout)
                                tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
                        else
@@ -2560,7 +2560,7 @@ int process_srv(struct session *t)
                        else if (unlikely(rep->flags & BF_READ_NULL ||
                                          c == CL_STSHUTW || c == CL_STCLOSE ||
                                          rep->l >= rep->rlim - rep->data)) {
-                               MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                               EV_FD_CLR(t->srv_fd, DIR_RD);
                                tv_eternity(&rep->rex);
                                shutdown(t->srv_fd, SHUT_RD);
                                t->srv_state = SV_STSHUTR;
@@ -2570,7 +2570,7 @@ int process_srv(struct session *t)
 
                        /* read timeout : return a 504 to the client.
                         */
-                       else if (unlikely(MY_FD_ISSET(t->srv_fd, StaticReadEvent) &&
+                       else if (unlikely(EV_FD_ISSET(t->srv_fd, DIR_RD) &&
                                          tv_cmp2_ms(&rep->rex, &now) <= 0)) {
                                tv_eternity(&rep->rex);
                                tv_eternity(&req->wex);
@@ -2605,12 +2605,12 @@ int process_srv(struct session *t)
                         */
                        else if (unlikely((/*c == CL_STSHUTR ||*/ c == CL_STCLOSE) &&
                                          (req->l == 0))) {
-                               MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                               EV_FD_CLR(t->srv_fd, DIR_WR);
                                tv_eternity(&req->wex);
 
                                /* We must ensure that the read part is still
                                 * alive when switching to shutw */
-                               MY_FD_SET(t->srv_fd, StaticReadEvent);
+                               EV_FD_SET(t->srv_fd, DIR_RD);
                                if (t->be->srvtimeout)
                                        tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
 
@@ -2624,14 +2624,14 @@ int process_srv(struct session *t)
                         * client shuts read too early, because we may still have
                         * some work to do on the headers.
                         */
-                       else if (unlikely(MY_FD_ISSET(t->srv_fd, StaticWriteEvent) &&
+                       else if (unlikely(EV_FD_ISSET(t->srv_fd, DIR_WR) &&
                                          tv_cmp2_ms(&req->wex, &now) <= 0)) {
-                               MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                               EV_FD_CLR(t->srv_fd, DIR_WR);
                                tv_eternity(&req->wex);
                                shutdown(t->srv_fd, SHUT_WR);
                                /* We must ensure that the read part is still alive
                                 * when switching to shutw */
-                               MY_FD_SET(t->srv_fd, StaticReadEvent);
+                               EV_FD_SET(t->srv_fd, DIR_RD);
                                if (t->be->srvtimeout)
                                        tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
 
@@ -2652,8 +2652,8 @@ int process_srv(struct session *t)
                         * long posts.
                         */
                        else if (likely(req->l)) {
-                               if (! MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
-                                       MY_FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
+                               if (! EV_FD_ISSET(t->srv_fd, DIR_WR)) {
+                                       EV_FD_SET(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,
@@ -2667,8 +2667,8 @@ int process_srv(struct session *t)
 
                        /* nothing left in the request buffer */
                        else {
-                               if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
-                                       MY_FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
+                               if (EV_FD_ISSET(t->srv_fd, DIR_WR)) {
+                                       EV_FD_CLR(t->srv_fd, DIR_WR); /* stop writing */
                                        tv_eternity(&req->wex);
                                }
                        }
@@ -2942,12 +2942,12 @@ int process_srv(struct session *t)
                 */
                if ((req->l == 0) &&
                    (c == CL_STSHUTR || c == CL_STCLOSE || t->be->options & PR_O_FORCE_CLO)) {
-                       MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                       EV_FD_CLR(t->srv_fd, DIR_WR);
                        tv_eternity(&req->wex);
 
                        /* We must ensure that the read part is still alive when switching
                         * to shutw */
-                       MY_FD_SET(t->srv_fd, StaticReadEvent);
+                       EV_FD_SET(t->srv_fd, DIR_RD);
                        if (t->be->srvtimeout)
                                tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
 
@@ -3004,7 +3004,7 @@ int process_srv(struct session *t)
                }
                /* last read, or end of client write */
                else if (rep->flags & BF_READ_NULL || c == CL_STSHUTW || c == CL_STCLOSE) {
-                       MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       EV_FD_CLR(t->srv_fd, DIR_RD);
                        tv_eternity(&rep->rex);
                        shutdown(t->srv_fd, SHUT_RD);
                        t->srv_state = SV_STSHUTR;
@@ -3013,12 +3013,12 @@ int process_srv(struct session *t)
                }
                /* end of client read and no more data to send */
                else if ((c == CL_STSHUTR || c == CL_STCLOSE) && (req->l == 0)) {
-                       MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                       EV_FD_CLR(t->srv_fd, DIR_WR);
                        tv_eternity(&req->wex);
                        shutdown(t->srv_fd, SHUT_WR);
                        /* We must ensure that the read part is still alive when switching
                         * to shutw */
-                       MY_FD_SET(t->srv_fd, StaticReadEvent);
+                       EV_FD_SET(t->srv_fd, DIR_RD);
                        if (t->be->srvtimeout)
                                tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
 
@@ -3027,7 +3027,7 @@ int process_srv(struct session *t)
                }
                /* read timeout */
                else if (tv_cmp2_ms(&rep->rex, &now) <= 0) {
-                       MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       EV_FD_CLR(t->srv_fd, DIR_RD);
                        tv_eternity(&rep->rex);
                        shutdown(t->srv_fd, SHUT_RD);
                        t->srv_state = SV_STSHUTR;
@@ -3039,12 +3039,12 @@ int process_srv(struct session *t)
                }       
                /* write timeout */
                else if (tv_cmp2_ms(&req->wex, &now) <= 0) {
-                       MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                       EV_FD_CLR(t->srv_fd, DIR_WR);
                        tv_eternity(&req->wex);
                        shutdown(t->srv_fd, SHUT_WR);
                        /* We must ensure that the read part is still alive when switching
                         * to shutw */
-                       MY_FD_SET(t->srv_fd, StaticReadEvent);
+                       EV_FD_SET(t->srv_fd, DIR_RD);
                        if (t->be->srvtimeout)
                                tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
                        t->srv_state = SV_STSHUTW;
@@ -3057,14 +3057,14 @@ int process_srv(struct session *t)
 
                /* recompute request time-outs */
                if (req->l == 0) {
-                       if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
-                               MY_FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
+                       if (EV_FD_ISSET(t->srv_fd, DIR_WR)) {
+                               EV_FD_CLR(t->srv_fd, DIR_WR); /* stop writing */
                                tv_eternity(&req->wex);
                        }
                }
                else { /* buffer not empty, there are still data to be transferred */
-                       if (! MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
-                               MY_FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
+                       if (! EV_FD_ISSET(t->srv_fd, DIR_WR)) {
+                               EV_FD_SET(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,
@@ -3078,14 +3078,14 @@ int process_srv(struct session *t)
 
                /* recompute response time-outs */
                if (rep->l == BUFSIZE) { /* no room to read more data */
-                       if (MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
-                               MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       if (EV_FD_ISSET(t->srv_fd, DIR_RD)) {
+                               EV_FD_CLR(t->srv_fd, DIR_RD);
                                tv_eternity(&rep->rex);
                        }
                }
                else {
-                       if (! MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
-                               MY_FD_SET(t->srv_fd, StaticReadEvent);
+                       if (! EV_FD_ISSET(t->srv_fd, DIR_RD)) {
+                               EV_FD_SET(t->srv_fd, DIR_RD);
                                if (t->be->srvtimeout)
                                        tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
                                else
@@ -3097,7 +3097,7 @@ int process_srv(struct session *t)
        }
        else if (s == SV_STSHUTR) {
                if (req->flags & BF_WRITE_ERROR) {
-                       //MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                       //EV_FD_CLR(t->srv_fd, DIR_WR);
                        tv_eternity(&req->wex);
                        fd_delete(t->srv_fd);
                        if (t->srv) {
@@ -3120,7 +3120,7 @@ int process_srv(struct session *t)
                        return 1;
                }
                else if ((c == CL_STSHUTR || c == CL_STCLOSE) && (req->l == 0)) {
-                       //MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                       //EV_FD_CLR(t->srv_fd, DIR_WR);
                        tv_eternity(&req->wex);
                        fd_delete(t->srv_fd);
                        if (t->srv)
@@ -3136,7 +3136,7 @@ int process_srv(struct session *t)
                        return 1;
                }
                else if (tv_cmp2_ms(&req->wex, &now) <= 0) {
-                       //MY_FD_CLR(t->srv_fd, StaticWriteEvent);
+                       //EV_FD_CLR(t->srv_fd, DIR_WR);
                        tv_eternity(&req->wex);
                        fd_delete(t->srv_fd);
                        if (t->srv)
@@ -3156,14 +3156,14 @@ int process_srv(struct session *t)
                        return 1;
                }
                else if (req->l == 0) {
-                       if (MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
-                               MY_FD_CLR(t->srv_fd, StaticWriteEvent); /* stop writing */
+                       if (EV_FD_ISSET(t->srv_fd, DIR_WR)) {
+                               EV_FD_CLR(t->srv_fd, DIR_WR); /* stop writing */
                                tv_eternity(&req->wex);
                        }
                }
                else { /* buffer not empty */
-                       if (! MY_FD_ISSET(t->srv_fd, StaticWriteEvent)) {
-                               MY_FD_SET(t->srv_fd, StaticWriteEvent); /* restart writing */
+                       if (! EV_FD_ISSET(t->srv_fd, DIR_WR)) {
+                               EV_FD_SET(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,
@@ -3178,7 +3178,7 @@ int process_srv(struct session *t)
        }
        else if (s == SV_STSHUTW) {
                if (rep->flags & BF_READ_ERROR) {
-                       //MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       //EV_FD_CLR(t->srv_fd, DIR_RD);
                        tv_eternity(&rep->rex);
                        fd_delete(t->srv_fd);
                        if (t->srv) {
@@ -3201,7 +3201,7 @@ int process_srv(struct session *t)
                        return 1;
                }
                else if (rep->flags & BF_READ_NULL || c == CL_STSHUTW || c == CL_STCLOSE) {
-                       //MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       //EV_FD_CLR(t->srv_fd, DIR_RD);
                        tv_eternity(&rep->rex);
                        fd_delete(t->srv_fd);
                        if (t->srv)
@@ -3217,7 +3217,7 @@ int process_srv(struct session *t)
                        return 1;
                }
                else if (tv_cmp2_ms(&rep->rex, &now) <= 0) {
-                       //MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       //EV_FD_CLR(t->srv_fd, DIR_RD);
                        tv_eternity(&rep->rex);
                        fd_delete(t->srv_fd);
                        if (t->srv)
@@ -3237,14 +3237,14 @@ int process_srv(struct session *t)
                        return 1;
                }
                else if (rep->l == BUFSIZE) { /* no room to read more data */
-                       if (MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
-                               MY_FD_CLR(t->srv_fd, StaticReadEvent);
+                       if (EV_FD_ISSET(t->srv_fd, DIR_RD)) {
+                               EV_FD_CLR(t->srv_fd, DIR_RD);
                                tv_eternity(&rep->rex);
                        }
                }
                else {
-                       if (! MY_FD_ISSET(t->srv_fd, StaticReadEvent)) {
-                               MY_FD_SET(t->srv_fd, StaticReadEvent);
+                       if (! EV_FD_ISSET(t->srv_fd, DIR_RD)) {
+                               EV_FD_SET(t->srv_fd, DIR_RD);
                                if (t->be->srvtimeout)
                                        tv_delayfrom(&rep->rex, &now, t->be->srvtimeout);
                                else
index 41bf46b747c78075ec3ffae434af1318aa42f5a1..ff3cdc7847f94042bed03f63570732a4da3de0ae 100644 (file)
@@ -147,7 +147,7 @@ int start_proxies(int verbose)
                        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].state = FD_STLISTEN;
-                       MY_FD_SET(fd, StaticReadEvent);
+                       EV_FD_SET(fd, DIR_RD);
                        fd_insert(fd);
                        listeners++;
                }
@@ -183,7 +183,7 @@ int maintain_proxies(void)
                        if (p->feconn < p->maxconn) {
                                if (p->state == PR_STIDLE) {
                                        for (l = p->listen; l != NULL; l = l->next) {
-                                               MY_FD_SET(l->fd, StaticReadEvent);
+                                               EV_FD_SET(l->fd, DIR_RD);
                                        }
                                        p->state = PR_STRUN;
                                }
@@ -191,7 +191,7 @@ int maintain_proxies(void)
                        else {
                                if (p->state == PR_STRUN) {
                                        for (l = p->listen; l != NULL; l = l->next) {
-                                               MY_FD_CLR(l->fd, StaticReadEvent);
+                                               EV_FD_CLR(l->fd, DIR_RD);
                                        }
                                        p->state = PR_STIDLE;
                                }
@@ -203,7 +203,7 @@ int maintain_proxies(void)
                while (p) {
                        if (p->state == PR_STRUN) {
                                for (l = p->listen; l != NULL; l = l->next) {
-                                       MY_FD_CLR(l->fd, StaticReadEvent);
+                                       EV_FD_CLR(l->fd, DIR_RD);
                                }
                                p->state = PR_STIDLE;
                        }
@@ -276,7 +276,7 @@ void pause_proxy(struct proxy *p)
                if (shutdown(l->fd, SHUT_WR) == 0 &&
                    listen(l->fd, p->maxconn) == 0 &&
                    shutdown(l->fd, SHUT_RD) == 0) {
-                       MY_FD_CLR(l->fd, StaticReadEvent);
+                       EV_FD_CLR(l->fd, DIR_RD);
                        if (p->state != PR_STERROR)
                                p->state = PR_STPAUSED;
                }
@@ -342,7 +342,7 @@ void listen_proxies(void)
                        for (l = p->listen; l != NULL; l = l->next) {
                                if (listen(l->fd, p->maxconn) == 0) {
                                        if (actconn < global.maxconn && p->feconn < p->maxconn) {
-                                               MY_FD_SET(l->fd, StaticReadEvent);
+                                               EV_FD_SET(l->fd, DIR_RD);
                                                p->state = PR_STRUN;
                                        }
                                        else
index f9e56272e4284e1b9c762cf2e30b4432b8376a72..a150a08de331d406618eca7796747f3f86a6f520 100644 (file)
@@ -67,7 +67,7 @@ int stream_sock_read(int fd) {
                        }
            
                        if (max == 0) {  /* not anymore room to store data */
-                               MY_FD_CLR(fd, StaticReadEvent);
+                               EV_FD_CLR(fd, DIR_RD);
                                break;
                        }
 
@@ -127,7 +127,7 @@ int stream_sock_read(int fd) {
        }
 
        if (b->flags & BF_READ_STATUS) {
-               if (b->rto && MY_FD_ISSET(fd, StaticReadEvent))
+               if (b->rto && EV_FD_ISSET(fd, DIR_RD))
                        tv_delayfrom(&b->rex, &now, b->rto);
                else
                        tv_eternity(&b->rex);
@@ -173,7 +173,7 @@ int stream_sock_write(int fd) {
                                        fdtab[fd].state = FD_STERROR;
                                        task_wakeup(&rq, fdtab[fd].owner);
                                        tv_eternity(&b->wex);
-                                       MY_FD_CLR(fd, StaticWriteEvent);
+                                       EV_FD_CLR(fd, DIR_WR);
                                        return 0;
                                }
                        }
@@ -182,7 +182,7 @@ int stream_sock_write(int fd) {
                        task_wakeup(&rq, fdtab[fd].owner);
                        fdtab[fd].state = FD_STREADY;
                        tv_eternity(&b->wex);
-                       MY_FD_CLR(fd, StaticWriteEvent);
+                       EV_FD_CLR(fd, DIR_WR);
                        return 0;
                }