applet_need_more_data(app);
applet_have_no_more_data(app);
+ if (sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) &&
+ sc_state_in(sco->state, SC_SB_RDY|SC_SB_EST|SC_SB_DIS|SC_SB_CLO)) {
+ sc_ep_clr(sc, SE_FL_APPLET_NEED_CONN);
+ sc_ep_report_read_activity(sc);
+ }
+
/* Now we'll try to allocate the input buffer. We wake up the applet in
* all cases. So this is the applet's responsibility to check if this
* buffer was allocated or not. This leaves a chance for applets to do
if (sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) &&
sc_state_in(sc_opposite(sc)->state, SC_SB_RDY|SC_SB_EST|SC_SB_DIS|SC_SB_CLO)) {
- sc_ep_clr(sc, SE_FL_APPLET_NEED_CONN);
- sc_ep_report_read_activity(sc);
+ /* connection available (or closed), so wake applet up to handle
+ * the event. here we are not in the applet context (but most
+ * probably in the connection context).
+ */
+ appctx_wakeup(__sc_appctx(sc));
}
if (!sc_is_recv_allowed(sc))
if (!appctx_app_test(__sc_appctx(sc), APPLET_FL_NEW_API))
return 0;
+ if (sc_ep_test(sc, SE_FL_APPLET_NEED_CONN) &&
+ sc_state_in(sc_opposite(sc)->state, SC_SB_RDY|SC_SB_EST|SC_SB_DIS|SC_SB_CLO)) {
+ sc_ep_clr(sc, SE_FL_APPLET_NEED_CONN);
+ sc_ep_report_read_activity(sc);
+ }
+
if (!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST))
return 0;