CLEANUP: extcheck: do not needlessly preset the server's address/port

During the config parsing we preset the server's address and port, but
that's pointless since it's replaced during each check in order to deal
with the possibility that the address was changed since.
This commit is contained in:
Willy Tarreau 2022-04-14 19:49:50 +02:00
parent a544c66716
commit c7edc9880a
1 changed files with 1 additions and 13 deletions

View File

@ -311,21 +311,9 @@ int prepare_external_check(struct check *check)
goto err;
}
if (!check->argv[1] || !check->argv[2]) {
ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
goto err;
}
/* args 3 and 4 are the address, they're replaced on each check */
check->argv[3] = calloc(EXTCHK_SIZE_ADDR, sizeof(*check->argv[3]));
check->argv[4] = calloc(EXTCHK_SIZE_UINT, sizeof(*check->argv[4]));
if (!check->argv[3] || !check->argv[4]) {
ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id);
goto err;
}
addr_to_str(&s->addr, check->argv[3], EXTCHK_SIZE_ADDR);
if (s->addr.ss_family == AF_INET || s->addr.ss_family == AF_INET6)
snprintf(check->argv[4], EXTCHK_SIZE_UINT, "%u", s->svc_port);
for (i = 0; i < 5; i++) {
if (!check->argv[i]) {