const struct buffer *buf = a3;
const size_t *val = a4;
- if (!ctx|| src->verbosity < PT_VERB_CLEAN)
+ if (!ctx || src->verbosity < PT_VERB_CLEAN)
return;
/* Display frontend/backend info by default */
if (src->verbosity == PT_VERB_CLEAN)
return;
+ if (!cs)
+ cs = ctx->cs;
+
/* Display the value to the 4th argument (level > STATE) */
if (src->level > TRACE_LEVEL_STATE && val)
chunk_appendf(&trace_buf, " - VAL=%lu", (long)*val);
/* Display conn and cs info, if defined (pointer + flags) */
chunk_appendf(&trace_buf, " - conn=%p(0x%08x)", conn, conn->flags);
+ chunk_appendf(&trace_buf, " endp=%p(0x%08x)", ctx->endp, ctx->endp->flags);
if (cs)
chunk_appendf(&trace_buf, " cs=%p(0x%08x)", cs, cs->flags);
{
struct mux_pt_ctx *ctx = tctx;
- TRACE_ENTER(PT_EV_CONN_WAKE, ctx->conn, ctx->cs);
- if (ctx->cs) {
+ TRACE_ENTER(PT_EV_CONN_WAKE, ctx->conn);
+ if (!(ctx->endp->flags & CS_EP_ORPHAN)) {
/* There's a small race condition.
* mux_pt_io_cb() is only supposed to be called if we have no
* stream attached. However, maybe the tasklet got woken up,
ctx->conn->subs = NULL;
} else if (ctx->cs->data_cb->wake)
ctx->cs->data_cb->wake(ctx->cs);
- TRACE_DEVEL("leaving waking up CS", PT_EV_CONN_WAKE, ctx->conn, ctx->cs);
+ TRACE_DEVEL("leaving waking up CS", PT_EV_CONN_WAKE, ctx->conn);
return t;
}
conn_ctrl_drain(ctx->conn);
}
else {
cs_attach_mux(cs, ctx, conn);
- ctx->cs = cs;
ctx->endp = cs->endp;
}
conn->ctx = ctx;
ctx->cs = cs;
- cs->endp->flags |= CS_EP_RCV_MORE;
+ ctx->endp->flags |= CS_EP_RCV_MORE;
if (global.tune.options & GTUNE_USE_SPLICE)
- cs->endp->flags |= CS_EP_MAY_SPLICE;
+ ctx->endp->flags |= CS_EP_MAY_SPLICE;
- TRACE_LEAVE(PT_EV_CONN_NEW, conn, cs);
+ TRACE_LEAVE(PT_EV_CONN_NEW, conn);
return 0;
fail_free_endp:
static int mux_pt_wake(struct connection *conn)
{
struct mux_pt_ctx *ctx = conn->ctx;
- struct conn_stream *cs = ctx->cs;
int ret = 0;
- TRACE_ENTER(PT_EV_CONN_WAKE, ctx->conn, cs);
- if (cs) {
- ret = cs->data_cb->wake ? cs->data_cb->wake(cs) : 0;
+ TRACE_ENTER(PT_EV_CONN_WAKE, ctx->conn);
+ if (!(ctx->endp->flags & CS_EP_ORPHAN)) {
+ ret = ctx->cs->data_cb->wake ? ctx->cs->data_cb->wake(ctx->cs) : 0;
if (ret < 0) {
- TRACE_DEVEL("leaving waking up CS", PT_EV_CONN_WAKE, ctx->conn, cs);
+ TRACE_DEVEL("leaving waking up CS", PT_EV_CONN_WAKE, ctx->conn);
return ret;
}
} else {
conn->xprt->unsubscribe(ctx->conn, conn->xprt_ctx, SUB_RETRY_RECV, &ctx->wait_event);
cs_attach_mux(cs, ctx, conn);
ctx->cs = cs;
- cs->endp->flags |= CS_EP_RCV_MORE;
+ ctx->endp = cs->endp;
+ ctx->endp->flags |= CS_EP_RCV_MORE;
TRACE_LEAVE(PT_EV_STRM_NEW, conn, cs);
return 0;
static const struct conn_stream *mux_pt_get_first_cs(const struct connection *conn)
{
struct mux_pt_ctx *ctx = conn->ctx;
- struct conn_stream *cs = ctx->cs;
- return cs;
+ return ctx->cs;
}
/* Destroy the mux and the associated connection if still attached to this mux
struct mux_pt_ctx *pt = ctx;
TRACE_POINT(PT_EV_CONN_END, pt->conn, pt->cs);
- if (!(pt->cs) || !(pt->conn) || pt->conn->ctx != pt) {
+ if ((pt->endp->flags & CS_EP_ORPHAN) || !(pt->conn) || pt->conn->ctx != pt) {
if (pt->conn->ctx != pt)
pt->endp = NULL;
mux_pt_destroy(pt);
{
struct mux_pt_ctx *ctx = conn->ctx;
- return ctx->cs ? 1 : 0;
+ return (!(ctx->endp->flags & CS_EP_ORPHAN) ? 1 : 0);
}
/* returns the number of streams still available on a connection */