[BUG] session: conn_retries was not always initialized

Johannes Smith reported some wrong retries count in logs associated with bad
requests. The cause was that the conn_retries field in the stream interface
was only initialized when attempting to connect, but is used when logging,
possibly with an uninitialized value holding last connection's conn_retries.
This could have been avoided by making use of a stream interface initializer.

This bug is 1.5-specific.
This commit is contained in:
Willy Tarreau 2011-03-27 19:16:56 +02:00
parent d3cff72fb6
commit 0b3a411543
2 changed files with 2 additions and 0 deletions

View File

@ -3987,6 +3987,7 @@ void http_end_txn_clean_session(struct session *s)
s->req->cons->state = s->req->cons->prev_state = SI_ST_INI;
s->req->cons->fd = -1; /* just to help with debugging */
s->req->cons->err_type = SI_ET_NONE;
s->req->cons->conn_retries = 0; /* used for logging too */
s->req->cons->err_loc = NULL;
s->req->cons->exp = TICK_ETERNITY;
s->req->cons->flags = SI_FL_NONE;

View File

@ -188,6 +188,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
s->si[1].owner = t;
s->si[1].state = s->si[1].prev_state = SI_ST_INI;
s->si[1].err_type = SI_ET_NONE;
s->si[1].conn_retries = 0; /* used for logging too */
s->si[1].err_loc = NULL;
s->si[1].connect = NULL;
s->si[1].release = NULL;