task_wakeup(stream->task, TASK_WOKEN_OTHER);
}
-/* Appends a dump of the state of stream <s> into buffer <buf> which must have
- * preliminary be prepared by its caller, with each line prepended by prefix
- * <pfx>, and each line terminated by character <eol>.
- */
-void stream_dump(struct buffer *buf, const struct stream *s, const char *pfx)
-{
- const struct stconn *scf, *scb;
- const struct connection *cof, *cob;
- const struct appctx *acf, *acb;
- const struct server *srv;
- const char *src = "unknown";
- const char *dst = "unknown";
- char pn[INET6_ADDRSTRLEN];
- const struct channel *req, *res;
- char eol = '\n';
-
- if (!s) {
- chunk_appendf(buf, "%sstrm=%p%c", pfx, s, eol);
- return;
- }
-
- if (s->obj_type != OBJ_TYPE_STREAM) {
- chunk_appendf(buf, "%sstrm=%p [invalid type=%d(%s)]%c",
- pfx, s, s->obj_type, obj_type_name(&s->obj_type), eol);
- return;
- }
-
- req = &s->req;
- res = &s->res;
-
- scf = s->scf;
- cof = (scf && scf->sedesc) ? sc_conn(scf) : NULL;
- acf = (scf && scf->sedesc) ? sc_appctx(scf) : NULL;
- if (cof && cof->src && addr_to_str(cof->src, pn, sizeof(pn)) >= 0)
- src = pn;
- else if (acf)
- src = acf->applet->name;
-
- scb = s->scb;
- cob = (scb && scb->sedesc) ? sc_conn(scb) : NULL;
- acb = (scb && scb->sedesc) ? sc_appctx(scb) : NULL;
- srv = objt_server(s->target);
- if (srv)
- dst = srv->id;
- else if (acb)
- dst = acb->applet->name;
-
- chunk_appendf(buf,
- "%sstrm=%p,%x src=%s fe=%s be=%s dst=%s%c"
- "%stxn=%p,%x txn.req=%s,%x txn.rsp=%s,%x%c"
- "%srqf=%x rqa=%x rpf=%x rpa=%x%c"
- "%sscf=%p,%s,%x scb=%p,%s,%x%c"
- "%saf=%p,%u sab=%p,%u%c"
- "%scof=%p,%x:%s(%p)/%s(%p)/%s(%d)%c"
- "%scob=%p,%x:%s(%p)/%s(%p)/%s(%d)%c"
- "",
- pfx, s, s->flags, src, s->sess->fe->id, s->be->id, dst, eol,
- pfx, s->txn, (s->txn ? s->txn->flags : 0),
- (s->txn ? h1_msg_state_str(s->txn->req.msg_state): "-"), (s->txn ? s->txn->req.flags : 0),
- (s->txn ? h1_msg_state_str(s->txn->rsp.msg_state): "-"), (s->txn ? s->txn->rsp.flags : 0), eol,
- pfx, req->flags, req->analysers, res->flags, res->analysers, eol,
- pfx, scf, scf ? sc_state_str(scf->state) : 0, scf ? scf->flags : 0,
- scb, scb ? sc_state_str(scb->state) : 0, scb ? scb->flags : 0, eol,
- pfx, acf, acf ? acf->st0 : 0, acb, acb ? acb->st0 : 0, eol,
- pfx, cof, cof ? cof->flags : 0, conn_get_mux_name(cof), cof?cof->ctx:0, conn_get_xprt_name(cof),
- cof ? cof->xprt_ctx : 0, conn_get_ctrl_name(cof), conn_fd(cof), eol,
- pfx, cob, cob ? cob->flags : 0, conn_get_mux_name(cob), cob?cob->ctx:0, conn_get_xprt_name(cob),
- cob ? cob->xprt_ctx : 0, conn_get_ctrl_name(cob), conn_fd(cob), eol);
-}
-
/* dumps an error message for type <type> at ptr <ptr> related to stream <s>,
* having reached loop rate <rate>, then aborts hoping to retrieve a core.
*/