mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-13 15:04:42 +00:00
MINOR: connection: make the debugging helper functions safer
We have various functions like conn_get_ctrl_name() to retrieve some information reported in "show sess" for debugging, which assume that the connection is valid. This is really not convenient in code aimed at debugging and is error-prone. Let's add a validity test first.
This commit is contained in:
parent
5e370daa52
commit
5e6a5b3a6e
@ -894,28 +894,28 @@ static inline const char *conn_err_code_str(struct connection *c)
|
||||
|
||||
static inline const char *conn_get_ctrl_name(const struct connection *conn)
|
||||
{
|
||||
if (!conn_ctrl_ready(conn))
|
||||
if (!conn || !conn_ctrl_ready(conn))
|
||||
return "NONE";
|
||||
return conn->ctrl->name;
|
||||
}
|
||||
|
||||
static inline const char *conn_get_xprt_name(const struct connection *conn)
|
||||
{
|
||||
if (!conn_xprt_ready(conn))
|
||||
if (!conn || !conn_xprt_ready(conn))
|
||||
return "NONE";
|
||||
return conn->xprt->name;
|
||||
}
|
||||
|
||||
static inline const char *conn_get_mux_name(const struct connection *conn)
|
||||
{
|
||||
if (!conn->mux)
|
||||
if (!conn || !conn->mux)
|
||||
return "NONE";
|
||||
return conn->mux->name;
|
||||
}
|
||||
|
||||
static inline const char *cs_get_data_name(const struct conn_stream *cs)
|
||||
{
|
||||
if (!cs->data_cb)
|
||||
if (!cs || !cs->data_cb)
|
||||
return "NONE";
|
||||
return cs->data_cb->name;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user