From: Christopher Faulet Date: Thu, 16 Dec 2021 15:11:28 +0000 (+0100) Subject: MEDIUM: stream: Allocate backend CS when the stream is created X-Git-Tag: v2.6-dev2~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2b38b31bb90bfe12b2d5dc348510e39e0c52775;p=thirdparty%2Fhaproxy.git MEDIUM: stream: Allocate backend CS when the stream is created Because the backend conn-stream is no longer released during connection retry and because it is valid to have conn-stream with no connection, it is possible to allocated it when the stream is created. This means, from now, a stream has always valid frontend and backend conn-streams. It is the first step to merge the SI and the CS. --- diff --git a/src/stream.c b/src/stream.c index f934ea0941..619d04eda6 100644 --- a/src/stream.c +++ b/src/stream.c @@ -494,6 +494,9 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin, struct bu if (likely(sess->fe->options2 & PR_O2_INDEPSTR)) s->si[1].flags |= SI_FL_INDEP_STR; + if (!si_alloc_cs(&s->si[1], NULL)) + goto out_fail_alloc_cs; + stream_init_srv_conn(s); s->target = sess->listener ? sess->listener->default_target : NULL; @@ -591,7 +594,9 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin, struct bu task_destroy(t); tasklet_free(s->si[1].wait_event.tasklet); LIST_DELETE(&s->list); -out_fail_alloc_si1: + out_fail_alloc_cs: + si_release_endpoint(&s->si[1]); + out_fail_alloc_si1: tasklet_free(s->si[0].wait_event.tasklet); out_fail_alloc: pool_free(pool_head_stream, s);