*
* <target> is the mux or the appctx
* <ctx> is the context set and used by <target>
+ * <cs> is the conn_stream we're attached to, or NULL
* <flags> CS_EP_*
*/
struct cs_endpoint {
void *target;
void *ctx;
+ struct conn_stream *cs;
unsigned int flags;
};
{
endp->target = NULL;
endp->ctx = NULL;
+ endp->cs = NULL;
endp->flags = CS_EP_NONE;
}
/* Tries to allocate a new conn_stream and initialize its main fields. On
* failure, nothing is allocated and NULL is returned. It is an internal
- * function. The caller must, at least, set the CS_EP_ORPHAN or CS_EP_DETACยงHED
+ * function. The caller must, at least, set the CS_EP_ORPHAN or CS_EP_DETACHED
* flag.
*/
static struct conn_stream *cs_new(struct cs_endpoint *endp)
goto alloc_error;
}
cs->endp = endp;
+ endp->cs = cs;
return cs;
if (conn->mux) {
/* TODO: handle unsubscribe for healthchecks too */
- cs->endp->flags |= CS_EP_ORPHAN;
if (cs->wait_event.events != 0)
conn->mux->unsubscribe(cs, cs->wait_event.events, &cs->wait_event);
+ cs->endp->flags |= CS_EP_ORPHAN;
+ cs->endp->cs = NULL;
conn->mux->detach(cs);
cs->endp = NULL;
}
else if (cs->endp->flags & CS_EP_T_APPLET) {
struct appctx *appctx = __cs_appctx(cs);
- cs->endp->flags |= CS_EP_ORPHAN;
cs_applet_shut(cs);
+ cs->endp->flags |= CS_EP_ORPHAN;
+ cs->endp->cs = NULL;
appctx_free(appctx);
cs->endp = NULL;
}
cs_detach_endp(&cs);
BUG_ON(cs->endp);
cs->endp = new_endp;
+ cs->endp->cs = cs;
cs->endp->flags |= CS_EP_DETACHED;
return 0;
}