summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faulet <cfaulet@haproxy.com>2021-11-15 11:31:08 +0100
committerChristopher Faulet <cfaulet@haproxy.com>2021-11-15 11:31:09 +0100
commit1ccbe12f4a6af471bdbc8b85f98eb16ae3e4a626 (patch)
tree7449aabf76a356793301b8dbe77953e0e65ee9d2
parentd9e6b3570140ca0cb4f8e1804ae36b490f2dbfaf (diff)
downloadhaproxy-1ccbe12f4a6af471bdbc8b85f98eb16ae3e4a626.tar.gz
DOC: log: Add comments to specify when session's listener is defined or not
When a log message is emitted, The session's listener is always defined when the session's owner is an inbound connection while it is undefined for a health-check. It is not obvious. So, comments have been added to make it clear. This patch is related to the issue #1434.
-rw-r--r--src/log.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/log.c b/src/log.c
index e7607c2c4..ecf771221 100644
--- a/src/log.c
+++ b/src/log.c
@@ -2117,6 +2117,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
case LOG_FMT_CLIENTPORT: // %cp
addr = (s ? si_src(&s->si[0]) : sess_src(sess));
if (addr) {
+ /* sess->listener is always defined when the session's owner is an inbound connections */
if (addr->ss_family == AF_UNIX)
ret = ltoa_o(sess->listener->luid, tmplog, dst + maxsize - tmplog);
else
@@ -2147,6 +2148,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
case LOG_FMT_FRONTENDPORT: // %fp
addr = (s ? si_dst(&s->si[0]) : sess_dst(sess));
if (addr) {
+ /* sess->listener is always defined when the session's owner is an inbound connections */
if (addr->ss_family == AF_UNIX)
ret = ltoa_o(sess->listener->luid, tmplog, dst + maxsize - tmplog);
else
@@ -2319,6 +2321,8 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
if (iret == 0)
goto out;
tmplog += iret;
+
+ /* sess->listener may be undefined if the session's owner is a health-check */
if (sess->listener && sess->listener->bind_conf->xprt == xprt_get(XPRT_SSL))
LOGCHAR('~');
if (tmp->options & LOG_OPT_QUOTE)