CLEANUP: rename possibly confusing struct field "tracked"
When reading the code, the "tracked" member of a server makes one
think the server is tracked while it's the opposite, it's a pointer
to the server being tracked. This is particularly true in constructs
such as :
if (srv->tracked) {
Since it's the second time I get caught misunderstanding it, let's
rename it to "track" to avoid the confusion.
diff --git a/include/types/server.h b/include/types/server.h
index 6b35c32..4cbd21c 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -110,7 +110,7 @@
char *iface_name; /* bind interface name or NULL */
struct port_range *sport_range; /* optional per-server TCP source ports */
- struct server *tracknext, *tracked; /* next server in a tracking list, tracked server */
+ struct server *tracknext, *track; /* next server in a tracking list, tracked server */
char *trackit; /* temporary variable to make assignment deferrable */
struct sockaddr_storage check_addr; /* the address to check, if different from <addr> */
short check_port; /* the port to use for the health checks */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index bf76185..a320bfb 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -6235,7 +6235,7 @@
goto next_srv;
}
- newsrv->tracked = srv;
+ newsrv->track = srv;
newsrv->tracknext = srv->tracknext;
srv->tracknext = newsrv;
diff --git a/src/checks.c b/src/checks.c
index f0338d7..67c2270 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -149,9 +149,9 @@
static void server_status_printf(struct chunk *msg, struct server *s, unsigned options, int xferred) {
- if (s->tracked)
+ if (s->track)
chunk_printf(msg, " via %s/%s",
- s->tracked->proxy->id, s->tracked->id);
+ s->track->proxy->id, s->track->id);
if (options & SSP_O_HCHK) {
chunk_printf(msg, ", reason: %s", get_check_status_description(s->check_status));
@@ -384,7 +384,7 @@
s->health = s->rise;
}
- if (s->health == s->rise || s->tracked) {
+ if (s->health == s->rise || s->track) {
int srv_was_paused = s->state & SRV_GOINGDOWN;
int prev_srv_count = s->proxy->srv_bck + s->proxy->srv_act;
@@ -413,7 +413,7 @@
s->proxy->id, s->id);
server_status_printf(&msg, s,
- ((!s->tracked && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
+ ((!s->track && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
xferred);
}
Warning("%s.\n", trash);
@@ -449,7 +449,7 @@
s->health = s->rise;
}
- if (s->health == s->rise || s->tracked) {
+ if (s->health == s->rise || s->track) {
if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0) {
if (s->proxy->last_change < now.tv_sec) // ignore negative times
s->proxy->down_time += now.tv_sec - s->proxy->last_change;
@@ -492,7 +492,7 @@
s->proxy->id, s->id);
server_status_printf(&msg, s,
- ((!s->tracked && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
+ ((!s->track && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
xferred);
}
@@ -536,7 +536,7 @@
s->proxy->id, s->id);
server_status_printf(&msg, s,
- ((!s->tracked && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
+ ((!s->track && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
xferred);
Warning("%s.\n", trash);
@@ -572,7 +572,7 @@
s->proxy->id, s->id);
server_status_printf(&msg, s,
- ((!s->tracked && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
+ ((!s->track && !(s->proxy->options2 & PR_O2_LOGHCHKS))?SSP_O_HCHK:0),
xferred);
Warning("%s.\n", trash);
diff --git a/src/dumpstats.c b/src/dumpstats.c
index a15b15b..f4d5c33 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -1159,11 +1159,11 @@
if (sv->state & SRV_MAINTAIN) {
/* The server is really in maintenance, we can change the server state */
- if (sv->tracked) {
+ if (sv->track) {
/* If this server tracks the status of another one,
* we must restore the good status.
*/
- if (sv->tracked->state & SRV_RUNNING) {
+ if (sv->track->state & SRV_RUNNING) {
set_server_up(sv);
sv->health = sv->rise; /* up, but will fall down at first failure */
} else {
@@ -2120,7 +2120,7 @@
{
struct session *s = si->applet.private;
struct buffer *rep = si->ib;
- struct server *sv, *svs; /* server and server-state, server-state=server or server->tracked */
+ struct server *sv, *svs; /* server and server-state, server-state=server or server->track */
struct listener *l;
struct chunk msg;
@@ -2541,8 +2541,8 @@
continue;
}
- if (sv->tracked)
- svs = sv->tracked;
+ if (sv->track)
+ svs = sv->track;
else
svs = sv;
@@ -2866,9 +2866,9 @@
chunk_printf(&msg, ",%lld,", sv->counters.cum_lbconn);
/* tracked */
- if (sv->tracked)
+ if (sv->track)
chunk_printf(&msg, "%s/%s,",
- sv->tracked->proxy->id, sv->tracked->id);
+ sv->track->proxy->id, sv->track->id);
else
chunk_printf(&msg, ",");
diff --git a/src/queue.c b/src/queue.c
index ea0bfb8..395d752 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -102,7 +102,7 @@
struct session *sess;
struct server *rsrv;
- rsrv = srv->tracked;
+ rsrv = srv->track;
if (!rsrv)
rsrv = srv;