struct appctx *app = context;
struct stconn *sc;
unsigned int rate;
+ int did_send, did_recv;
TRACE_ENTER(APPLET_EV_PROCESS, app);
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
applet_fl_test(app, APPCTX_FL_EOI|APPCTX_FL_EOS|APPCTX_FL_ERROR))
applet_have_more_data(app);
- sc_applet_sync_recv(sc);
+ did_recv = sc_applet_sync_recv(sc);
/* TODO: May be move in appctx_rcv_buf or sc_applet_process ? */
if (sc_waiting_room(sc) && (sc->flags & SC_FL_ABRT_DONE)) {
}
/* 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));