mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: stream/cli: use conn_get_{src,dst} in "show sess" and "show peers" output
The stream outputs requires to retrieve connections sources and destinations. The previous call involving conn_get_{to,from}_addr() was missing a status check which has now been integrated with the new call since these places already handle connection errors there. The same code parts were reused for "show peers" and were modified similarly.
This commit is contained in:
parent
7bb447c3dd
commit
8dfffdb060
@ -3128,7 +3128,7 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru
|
||||
if (conn)
|
||||
chunk_appendf(&trash, "\n xprt=%s", conn_get_xprt_name(conn));
|
||||
|
||||
switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
switch (conn && conn_get_src(conn) ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
chunk_appendf(&trash, " src=%s:%d", pn, get_host_port(&conn->addr.from));
|
||||
@ -3138,10 +3138,7 @@ static int peers_dump_peer(struct buffer *msg, struct stream_interface *si, stru
|
||||
break;
|
||||
}
|
||||
|
||||
if (conn)
|
||||
conn_get_to_addr(conn);
|
||||
|
||||
switch (conn ? addr_to_str(&conn->addr.to, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
switch (conn && conn_get_dst(conn) ? addr_to_str(&conn->addr.to, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
chunk_appendf(&trash, " addr=%s:%d", pn, get_host_port(&conn->addr.to));
|
||||
|
15
src/stream.c
15
src/stream.c
@ -3083,10 +3083,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
|
||||
strm_li(strm) ? strm_li(strm)->name ? strm_li(strm)->name : "?" : "?",
|
||||
strm_li(strm) ? strm_li(strm)->luid : 0);
|
||||
|
||||
if (conn)
|
||||
conn_get_to_addr(conn);
|
||||
|
||||
switch (conn ? addr_to_str(&conn->addr.to, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
switch (conn && conn_get_dst(conn) ? addr_to_str(&conn->addr.to, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
chunk_appendf(&trash, " addr=%s:%d\n",
|
||||
@ -3112,10 +3109,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
|
||||
cs = objt_cs(strm->si[1].end);
|
||||
conn = cs_conn(cs);
|
||||
|
||||
if (conn)
|
||||
conn_get_from_addr(conn);
|
||||
|
||||
switch (conn ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
switch (conn && conn_get_src(conn) ? addr_to_str(&conn->addr.from, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
chunk_appendf(&trash, " addr=%s:%d\n",
|
||||
@ -3138,10 +3132,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st
|
||||
else
|
||||
chunk_appendf(&trash, " server=<NONE> (id=-1)");
|
||||
|
||||
if (conn)
|
||||
conn_get_to_addr(conn);
|
||||
|
||||
switch (conn ? addr_to_str(&conn->addr.to, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
switch (conn && conn_get_dst(conn) ? addr_to_str(&conn->addr.to, pn, sizeof(pn)) : AF_UNSPEC) {
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
chunk_appendf(&trash, " addr=%s:%d\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user