]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: applet: centralize the call to si_applet_done() in the I/O handler
authorWilly Tarreau <w@1wt.eu>
Sun, 19 Apr 2015 23:31:23 +0000 (01:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Apr 2015 15:56:17 +0000 (17:56 +0200)
It's much easier to centralize this call into the I/O handler than to
do it everywhere with the risk to miss it. Applets are not allowed to
unregister themselves anyway so their SI is still present and it is
possible to update all the context.

src/applet.c
src/dumpstats.c
src/hlua.c
src/peers.c

index 3aa67e72c0ee5121b7241356f0ef0cd0006f9b9a..37303f7447333496b6cfd228b06c5c897bcc80ee 100644 (file)
@@ -38,6 +38,6 @@ void applet_run_active()
                }
 
                curr->applet->fct(curr);
-               /* must not dereference curr nor si now because it might have been freed */
+               si_applet_done(si);
        }
 }
index 5a890e9dd02a501eb945fc92992e40a3f459f6ce..c835b1eb98fd4a0fb1e3b64d9e18d8e44293c10b 100644 (file)
@@ -2429,13 +2429,6 @@ static void cli_io_handler(struct appctx *appctx)
        }
 
  out:
-       /* update all other flags and resync with the other side */
-       si_applet_done(si);
-
-       /* we don't want to expire timeouts while we're processing requests */
-       si_ic(si)->rex = TICK_ETERNITY;
-       si_oc(si)->wex = TICK_ETERNITY;
-
        DPRINTF(stderr, "%s@%d: st=%d, rqf=%x, rpf=%x, rqh=%d, rqs=%d, rh=%d, rs=%d\n",
                __FUNCTION__, __LINE__,
                si->state, req->flags, res->flags, req->buf->i, req->buf->o, res->buf->i, res->buf->o);
@@ -4961,14 +4954,8 @@ static void http_stats_io_handler(struct appctx *appctx)
                        res->flags |= CF_READ_NULL;
                }
        }
-
  out:
-       /* update all other flags and resync with the other side */
-       si_applet_done(si);
-
-       /* we don't want to expire timeouts while we're processing requests */
-       si_ic(si)->rex = TICK_ETERNITY;
-       si_oc(si)->wex = TICK_ETERNITY;
+       /* just to make gcc happy */ ;
 }
 
 
index fb006e6e1ebf32eaacb0f5adb7e613f14b9f84bb..37fce89edfeac8b8e5a7f9de0b6c0e86b43209a5 100644 (file)
@@ -1446,11 +1446,11 @@ static void hlua_socket_handler(struct appctx *appctx)
                si_ic(si)->flags |= CF_READ_NULL;
                hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
                hlua_com_wake(&appctx->ctx.hlua.wake_on_write);
-               goto leave;
+               return;
        }
 
        if (!(c->flags & CO_FL_CONNECTED))
-               goto leave;
+               return;
 
        /* This function is called after the connect. */
        appctx->ctx.hlua.connected = 1;
@@ -1462,9 +1462,6 @@ static void hlua_socket_handler(struct appctx *appctx)
        /* Wake the tasks which wants to read if the buffer contains data. */
        if (channel_is_empty(si_ic(si)))
                hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
-
- leave:
-       si_applet_done(si);
 }
 
 /* This function is called when the "struct stream" is destroyed.
index 97a87289da4ff0c928b2c74b02729a8d7ffaa478..5b6d817861e46fff2b07e23c45899962d2eaef86 100644 (file)
@@ -1043,11 +1043,7 @@ incomplete:
                }
        }
 out:
-       si_applet_done(si);
        si_oc(si)->flags |= CF_READ_DONTWAIT;
-       /* we don't want to expire timeouts while we're processing requests */
-       si_ic(si)->rex = TICK_ETERNITY;
-       si_oc(si)->wex = TICK_ETERNITY;
        return;
 full:
        si->flags |= SI_FL_WAIT_ROOM;