}
}
+/* indicates if the connector may send data to the endpoint, that is, the
+ * endpoint is both willing to receive data and ready to do so. This is only
+ * used with applets so there's always a stream attached to this connector.
+ */
+__attribute__((warn_unused_result))
+static inline int sc_is_send_allowed(const struct stconn *sc)
+{
+ return cs_tx_endp_ready(sc) && !cs_tx_blocked(sc);
+}
+
#endif /* _HAPROXY_CS_UTILS_H */
if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second
((b_size(sc_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_BUFF)) || // asks for a buffer which is present
(b_size(sc_ib(cs)) && !b_data(sc_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_ROOM)) || // asks for room in an empty buffer
- (b_data(sc_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present
+ (b_data(sc_ob(cs)) && sc_is_send_allowed(cs)) || // asks for data already present
(!b_data(sc_ib(cs)) && b_data(sc_ob(cs)) && // didn't return anything ...
(sc_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
* appctx but in the case the task is not in runqueue we may have to
* wakeup the appctx immediately.
*/
- if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs)) ||
- (cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)))
+ if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs)) || sc_is_send_allowed(cs))
appctx_wakeup(__sc_appctx(cs));
return 0;
}
* handled at the latest moment.
*/
if (sc_appctx(scf)) {
- if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf)) ||
- (cs_tx_endp_ready(scf) && !cs_tx_blocked(scf)))
+ if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf)) || sc_is_send_allowed(scf))
appctx_wakeup(__sc_appctx(scf));
}
if (sc_appctx(scb)) {
- if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb)) ||
- (cs_tx_endp_ready(scb) && !cs_tx_blocked(scb)))
+ if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb)) || sc_is_send_allowed(scb))
appctx_wakeup(__sc_appctx(scb));
}
}