mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-01 11:01:46 +00:00
MINOR: connection: always initialize conn->objt_type to OBJ_TYPE_CONN
We do this everywhere we prepare a connection so that we can safely switch to objt_conn() next.
This commit is contained in:
parent
51c2184755
commit
1e6902fd6a
@ -1162,6 +1162,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio
|
||||
|
||||
s->req = s->rep = NULL; /* will be allocated later */
|
||||
|
||||
s->si[0].conn->obj_type = OBJ_TYPE_CONN;
|
||||
s->si[0].conn->t.sock.fd = -1;
|
||||
s->si[0].conn->flags = CO_FL_NONE;
|
||||
s->si[0].conn->err_code = CO_ER_NONE;
|
||||
@ -1180,6 +1181,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio
|
||||
s->si[0].applet.st0 = PEER_SESSION_CONNECT;
|
||||
s->si[0].applet.ptr = (void *)ps;
|
||||
|
||||
s->si[1].conn->obj_type = OBJ_TYPE_CONN;
|
||||
s->si[1].conn->t.sock.fd = -1; /* just to help with debugging */
|
||||
s->si[1].conn->flags = CO_FL_NONE;
|
||||
s->si[1].conn->err_code = CO_ER_NONE;
|
||||
|
@ -4283,6 +4283,7 @@ void http_end_txn_clean_session(struct session *s)
|
||||
s->target = NULL;
|
||||
|
||||
s->req->cons->state = s->req->cons->prev_state = SI_ST_INI;
|
||||
s->req->cons->conn->obj_type = OBJ_TYPE_CONN;
|
||||
s->req->cons->conn->t.sock.fd = -1; /* just to help with debugging */
|
||||
s->req->cons->conn->flags = CO_FL_NONE;
|
||||
s->req->cons->conn->err_code = CO_ER_NONE;
|
||||
|
@ -105,6 +105,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
s->fe = p;
|
||||
|
||||
/* OK, we're keeping the session, so let's properly initialize the session */
|
||||
s->si[0].conn->obj_type = OBJ_TYPE_CONN;
|
||||
s->si[0].conn->t.sock.fd = cfd;
|
||||
s->si[0].conn->ctrl = l->proto;
|
||||
s->si[0].conn->flags = CO_FL_NONE | CO_FL_ADDR_FROM_SET;
|
||||
@ -112,6 +113,11 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
s->si[0].conn->addr.from = *addr;
|
||||
s->si[0].conn->target = &l->obj_type;
|
||||
|
||||
/* FIXME: this should be replaced with OBJ_TYPE_NONE once all users check the
|
||||
* object type before dereferencing the connection pointer.
|
||||
*/
|
||||
s->si[1].conn->obj_type = OBJ_TYPE_CONN;
|
||||
|
||||
s->logs.accept_date = date; /* user-visible date for logging */
|
||||
s->logs.tv_accept = now; /* corrected date for internal use */
|
||||
s->uniq_id = totalconn;
|
||||
@ -453,6 +459,7 @@ int session_complete(struct session *s)
|
||||
/* pre-initialize the other side's stream interface to an INIT state. The
|
||||
* callbacks will be initialized before attempting to connect.
|
||||
*/
|
||||
s->si[1].conn->obj_type = OBJ_TYPE_CONN;
|
||||
s->si[1].conn->t.sock.fd = -1; /* just to help with debugging */
|
||||
s->si[1].conn->flags = CO_FL_NONE;
|
||||
s->si[1].conn->err_code = CO_ER_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user