#define TCPCHK_OPT_DEFAULT_CONNECT 0x0008 /* Do a connect using server params */
#define TCPCHK_OPT_IMPLICIT 0x0010 /* Implicit connect */
#define TCPCHK_OPT_SOCKS4 0x0020 /* check the connection via socks4 proxy */
+#define TCPCHK_OPT_HAS_DATA 0x0040 /* data should be sent after conncetion */
enum tcpcheck_send_type {
TCPCHK_SEND_UNDEF = 0, /* Send is not parsed. */
LIST_INSERT(srv->agent.tcpcheck_rules->list, &chk->list);
}
+ /* <chk> is always defined here and it is a CONNECT action. If there is
+ * a preset variable, it means there is an agent string defined and data
+ * will be sent after the connect.
+ */
+ if (!LIST_ISEMPTY(&srv->agent.tcpcheck_rules->preset_vars))
+ chk->connect.options |= TCPCHK_OPT_HAS_DATA;
+
err = init_check(&srv->agent, PR_O2_TCPCHK_CHK);
if (err) {
if (proto && proto->connect) {
int flags = 0;
- if (check->tcpcheck_rules->flags & TCPCHK_RULES_PROTO_CHK)
- flags |= CONNECT_HAS_DATA;
- if (!next || next->action != TCPCHK_ACT_EXPECT)
- flags |= CONNECT_DELACK_ALWAYS;
+ if (connect->options & TCPCHK_OPT_HAS_DATA)
+ flags = (CONNECT_HAS_DATA|CONNECT_DELACK_ALWAYS);
status = proto->connect(conn, flags);
}
* comment is assigned to the following rule(s).
*/
list_for_each_entry_safe(chk, back, px->tcpcheck_rules.list, list) {
+ struct tcpcheck_rule *next;
+
if (chk->action != prev_action && prev_action != TCPCHK_ACT_COMMENT)
ha_free(&comment);
case TCPCHK_ACT_CONNECT:
if (!chk->comment && comment)
chk->comment = strdup(comment);
+ next = get_next_tcpcheck_rule(&px->tcpcheck_rules, chk);
+ if (next && next->action == TCPCHK_ACT_SEND)
+ chk->connect.options |= TCPCHK_OPT_HAS_DATA;
/* fall through */
case TCPCHK_ACT_ACTION_KW:
ha_free(&comment);