MAJOR: conn_stream/stream-int: move the appctx to the conn-stream
Thanks to previous changes, it is now possible to set an appctx as endpoint
for a conn-stream. This means the appctx is no longer linked to the
stream-interface but to the conn-stream. Thus, a pointer to the conn-stream
is explicitly stored in the stream-interface. The endpoint (connection or
appctx) can be retrieved via the conn-stream.
diff --git a/src/http_client.c b/src/http_client.c
index 1877a0f..64e5190 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -454,6 +454,7 @@
struct applet *applet = &httpclient_applet;
struct appctx *appctx;
struct session *sess;
+ struct conn_stream *cs;
struct stream *s;
int len;
struct sockaddr_storage ss_url;
@@ -485,9 +486,14 @@
ha_alert("httpclient: out of memory in %s:%d.\n", __FUNCTION__, __LINE__);
goto out_free_appctx;
}
- if ((s = stream_new(sess, &appctx->obj_type, &hc->req.buf)) == NULL) {
+ cs = cs_new(&appctx->obj_type);
+ if (!cs) {
+ ha_alert("httpclient: out of memory in %s:%d.\n", __FUNCTION__, __LINE__);
+ goto out_free_sess;
+ }
+ if ((s = stream_new(sess, cs, &hc->req.buf)) == NULL) {
ha_alert("httpclient: Failed to initialize stream %s:%d.\n", __FUNCTION__, __LINE__);
- goto out_free_appctx;
+ goto out_free_cs;
}
/* set the "timeout server" */
@@ -528,7 +534,6 @@
si_cant_get(&s->si[0]);
appctx_wakeup(appctx);
- task_wakeup(s->task, TASK_WOKEN_INIT);
hc->appctx = appctx;
hc->flags |= HTTPCLIENT_FS_STARTED;
appctx->ctx.httpclient.ptr = hc;
@@ -543,6 +548,8 @@
out_free_stream:
LIST_DELETE(&s->list);
pool_free(pool_head_stream, s);
+out_free_cs:
+ cs_free(cs);
out_free_sess:
session_free(sess);
out_free_appctx: