]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: Inconsistency when dumping peer status codes.
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 5 Oct 2020 10:33:07 +0000 (12:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Oct 2020 05:27:01 +0000 (07:27 +0200)
A peer connection status must be considered as valid only if there is an applet
which has been instantiated for the connection to the peer. So, ->statuscode
should be considered as the last known peer connection status from the last
connection to this peer if any. To reflect this, "statuscode" field of peer dump
is renamed to "last_statuscode".
This patch also add "active"/"inactive" field after the peer location type
("remote" or "local") if an applet has been instantiated for this peer connection
or not.

Thank you to Emeric for having noticed this issue.

Must be backported in >=1.9 version.

src/peers.c

index fcea37ec1c845def8caacc5a206aea4fc81ace4c..d76a1f87650e054b858deddb54bcb568b3315eb4 100644 (file)
@@ -3099,9 +3099,10 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru
        struct shared_table *st;
 
        addr_to_str(&peer->addr, pn, sizeof pn);
-       chunk_appendf(msg, "  %p: id=%s(%s) addr=%s:%d status=%s reconnect=%s confirm=%u tx_hbt=%u rx_hbt=%u no_hbt=%u new_conn=%u proto_err=%u\n",
+       chunk_appendf(msg, "  %p: id=%s(%s,%s) addr=%s:%d last_status=%s reconnect=%s confirm=%u tx_hbt=%u rx_hbt=%u no_hbt=%u new_conn=%u proto_err=%u\n",
                      peer, peer->id,
                      peer->local ? "local" : "remote",
+                     peer->appctx ? "active" : "inactive",
                      pn, get_host_port(&peer->addr),
                      statuscode_str(peer->statuscode),
                      peer->reconnect ?