MINOR: h2: unify the mux init function

The init function was split into the mux init and the front init, but it
appears that most of the code will be common between the two sides when
implementing the backend init. Thus let's simply make this a unique
h2_init() function.
This commit is contained in:
Willy Tarreau 2018-10-03 13:52:41 +02:00
parent 6bf641a61d
commit 7dc24e49cc

View File

@ -349,13 +349,21 @@ static inline void h2_release_buf(struct h2c *h2c, struct buffer *bptr)
/* functions below are dedicated to the mux setup and management */
/*****************************************************************/
/* tries to initialize the inbound h2c mux. Returns < 0 in case of failure. */
static int h2c_frt_init(struct connection *conn)
/* Initialize the mux once it's attached. For outgoing connections, the context
* is already initialized before installing the mux, so we detect incoming
* connections from the fact that the context is still NULL. Returns < 0 on
* error.
*/
static int h2_init(struct connection *conn, struct proxy *prx)
{
struct h2c *h2c;
struct task *t = NULL;
struct session *sess = conn->owner;
/* we don't support outgoing connections for now */
if (conn->mux_ctx)
goto fail_no_h2c;
h2c = pool_alloc(pool_head_h2c);
if (!h2c)
goto fail_no_h2c;
@ -431,21 +439,6 @@ static int h2c_frt_init(struct connection *conn)
return -1;
}
/* Initialize the mux once it's attached. For outgoing connections, the context
* is already initialized before installing the mux, so we detect incoming
* connections from the fact that the context is still NULL. Returns < 0 on
* error.
*/
static int h2_init(struct connection *conn, struct proxy *prx)
{
if (conn->mux_ctx) {
/* we don't support outgoing connections for now */
return -1;
}
return h2c_frt_init(conn);
}
/* returns the stream associated with id <id> or NULL if not found */
static inline struct h2s *h2c_st_by_id(struct h2c *h2c, int id)
{