diff --git a/src/applet.c b/src/applet.c index b71096ae9..4b55bf9b5 100644 --- a/src/applet.c +++ b/src/applet.c @@ -898,6 +898,7 @@ struct task *task_process_applet(struct task *t, void *context, unsigned int sta struct appctx *app = context; struct stconn *sc; unsigned int rate; + int did_send, did_recv; TRACE_ENTER(APPLET_EV_PROCESS, app); @@ -925,6 +926,7 @@ struct task *task_process_applet(struct task *t, void *context, unsigned int sta sc = appctx_sc(app); sc_applet_sync_send(sc); + did_send = (sc_oc(sc)->flags & CF_WRITE_EVENT); /* We always pretend the applet can't get and doesn't want to * put, it's up to it to change this if needed. This ensures @@ -940,7 +942,7 @@ struct task *task_process_applet(struct task *t, void *context, unsigned int sta if (b_data(&app->outbuf) || se_fl_test(app->sedesc, SE_FL_MAY_FASTFWD_PROD)) applet_have_more_data(app); - sc_applet_sync_recv(sc); + did_recv = sc_applet_sync_recv(sc); if (!se_fl_test(app->sedesc, SE_FL_WANT_ROOM)) { /* Handle EOI/EOS/ERROR outside of data transfer. But take care @@ -966,11 +968,7 @@ struct task *task_process_applet(struct task *t, void *context, unsigned int sta } /* measure the call rate and check for anomalies when too high */ - if (((b_size(sc_ib(sc)) && sc->flags & SC_FL_NEED_BUFF) || // asks for a buffer which is present - (b_size(sc_ib(sc)) && !b_data(sc_ib(sc)) && sc->flags & SC_FL_NEED_ROOM) || // asks for room in an empty buffer - (b_data(sc_ob(sc)) && sc_is_send_allowed(sc)) || // asks for data already present - (!b_data(sc_ib(sc)) && b_data(sc_ob(sc)) && // didn't return anything ... - (!(sc_oc(sc)->flags & CF_WRITE_EVENT) && (sc->flags & SC_FL_SHUT_WANTED))))) { // ... and left data pending after a shut + if (!did_recv && !did_send) { rate = update_freq_ctr(&app->call_rate, 1); if (rate >= 100000 && app->call_rate.prev_ctr) // looped like this more than 100k times over last second stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));