BUG/MAJOR: backend: only update server's counters when the server exists

PiBa-NL reported that since this commit f157384 ("MINOR: backend: count
the number of connect and reuse per server and per backend"), reg-test
connection/h00001 fails. Indeed it does, the server is not checked for
existing prior to updating its counter. It should also fail with
transparent mode.
This commit is contained in:
Willy Tarreau 2018-12-15 15:11:36 +01:00
parent 37dd54d8d4
commit cc79ed28f6

View File

@ -1378,10 +1378,12 @@ int connect_server(struct stream *s)
if (s->flags & SF_SRV_REUSED) {
HA_ATOMIC_ADD(&s->be->be_counters.reuse, 1);
HA_ATOMIC_ADD(&srv->counters.reuse, 1);
if (srv)
HA_ATOMIC_ADD(&srv->counters.reuse, 1);
} else {
HA_ATOMIC_ADD(&s->be->be_counters.connect, 1);
HA_ATOMIC_ADD(&srv->counters.connect, 1);
if (srv)
HA_ATOMIC_ADD(&srv->counters.connect, 1);
}
err = si_connect(&s->si[1], srv_conn);