[MEDIUM] checks: group health checks methods by values and save option bits
Adding health checks has become a real pain, with cross-references to all
checks everywhere because they're all a single bit. Since they're all
exclusive, let's change this to have a check number only. We reserve 4
bits allowing up to 16 checks (15+tcp), only 7 of which are currently
used. The code has shrunk by almost 1kB and we saved a few option bits.
The "dispatch" option has been moved to px->options, making a few tests
a bit cleaner.
diff --git a/src/backend.c b/src/backend.c
index d76324f..2cbc888 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -618,7 +618,7 @@
}
set_target_server(&s->target, srv);
}
- else if ((s->be->options2 & PR_O2_DISPATCH) || (s->be->options & PR_O_TRANSP)) {
+ else if (s->be->options & (PR_O_DISPATCH | PR_O_TRANSP)) {
set_target_proxy(&s->target, s->be);
}
else if ((s->be->options & PR_O_HTTP_PROXY) &&
@@ -720,7 +720,7 @@
}
}
}
- else if (s->be->options2 & PR_O2_DISPATCH) {
+ else if (s->be->options & PR_O_DISPATCH) {
/* connect to the defined dispatch addr */
s->req->cons->addr.s.to = s->be->dispatch_addr;
}