static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *buf)
{
- struct session *sess = qcs->qcc->conn->owner;
+ struct qcc *qcc = qcs->qcc;
+ struct session *sess = qcc->conn->owner;
+
+ qcs->endp = cs_endpoint_new();
+ if (!qcs->endp)
+ return NULL;
+
+ qcs->endp->target = qcs;
+ qcs->endp->ctx = qcc->conn;
+ qcs->endp->flags |= (CS_EP_T_MUX|CS_EP_ORPHAN|CS_EP_NOT_FIRST);
/* TODO duplicated from mux_h2 */
sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
if (!cs_new_from_endp(qcs->endp, sess, buf))
return NULL;
- ++qcs->qcc->nb_cs;
+ ++qcc->nb_cs;
/* TODO duplicated from mux_h2 */
sess->accept_date = date;
goto err;
}
- qcs->endp = cs_endpoint_new();
- if (!qcs->endp) {
- pool_free(pool_head_qcs, qcs);
- goto err;
- }
- qcs->endp->target = qcs;
- qcs->endp->ctx = qcc->conn;
- qcs->endp->flags |= (CS_EP_T_MUX|CS_EP_ORPHAN|CS_EP_NOT_FIRST);
-
qcs->id = qcs->by_id.key = id;
/* store transport layer stream descriptor in qcc tree */
eb64_insert(&qcc->streams_by_id, &qcs->by_id);
node = eb64_next(node)) {
qcs = eb64_entry(node, struct qcs, by_id);
- if (!qcs->endp->cs)
+ if (!qcs->endp || !qcs->endp->cs)
continue;
if (qcc->conn->flags & CO_FL_ERROR) {