MINOR: stream: Rely on CS's info if it exists and fallback on session's ones
When the stream is created, If si_get_cs_info() returns valid info for the client
connection stream, we use it. Otherwise we use session' info.
diff --git a/src/stream.c b/src/stream.c
index 5c5091c..5def7f1 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -128,6 +128,7 @@
struct task *t;
struct conn_stream *cs = objt_cs(origin);
struct appctx *appctx = objt_appctx(origin);
+ const struct cs_info *csinfo;
if (unlikely((s = pool_alloc(pool_head_stream)) == NULL))
goto out_fail_alloc;
@@ -141,10 +142,6 @@
s->flags = 0;
s->logs.logwait = sess->fe->to_log;
s->logs.level = 0;
- s->logs.accept_date = sess->accept_date; /* user-visible date for logging */
- s->logs.tv_accept = sess->tv_accept; /* corrected date for internal use */
- s->logs.t_handshake = sess->t_handshake;
- s->logs.t_idle = -1;
tv_zero(&s->logs.tv_request);
s->logs.t_queue = -1;
s->logs.t_connect = -1;
@@ -154,6 +151,20 @@
s->logs.prx_queue_pos = 0; /* we get the number of pending conns before us */
s->logs.srv_queue_pos = 0; /* we will get this number soon */
+ csinfo = si_get_cs_info(cs);
+ if (csinfo) {
+ s->logs.accept_date = csinfo->create_date;
+ s->logs.tv_accept = csinfo->tv_create;
+ s->logs.t_handshake = csinfo->t_handshake;
+ s->logs.t_idle = csinfo->t_idle;
+ }
+ else {
+ s->logs.accept_date = sess->accept_date;
+ s->logs.tv_accept = sess->tv_accept;
+ s->logs.t_handshake = sess->t_handshake;
+ s->logs.t_idle = -1;
+ }
+
/* default logging function */
s->do_log = strm_log;