srv_conn = NULL;
if (cs_reset_endp(s->csb) < 0)
return SF_ERR_INTERNAL;
+ s->csb->endp->flags &= CS_EP_DETACHED;
}
}
else
TRACE_DEVEL("closing current connection", CHK_EV_TASK_WAKE|CHK_EV_HCHK_RUN, check);
check->state &= ~CHK_ST_CLOSE_CONN;
conn = NULL;
- cs_reset_endp(check->cs); /* error will be handled by tcpcheck_main() */
+ if (!cs_reset_endp(check->cs)) {
+ /* error will be handled by tcpcheck_main().
+ * On success, remove all flags except CS_EP_DETACHED
+ */
+ check->cs->endp->flags &= CS_EP_DETACHED;
+ }
tcpcheck_main(check);
}
if (check->result == CHK_RES_UNKNOWN) {
s->srv_error(s, s->csb);
return 1;
}
+ s->csb->endp->flags &= CS_EP_DETACHED;
}
sockaddr_free(&s->csb->dst);
if (cs->endp) {
/* the cs is the only one one the endpoint */
- cs_endpoint_init(cs->endp);
+ cs->endp->target = NULL;
+ cs->endp->ctx = NULL;
cs->endp->flags |= CS_EP_DETACHED;
}
/* Resets the conn-stream endpoint. It happens when the app layer want to renew
* its endpoint. For a connection retry for instance. If a mux or an applet is
* attached, a new endpoint is created. Returns -1 on error and 0 on sucess.
+ *
+ * Only CS_EP_ERROR flag is removed on the endpoint. Orther flags are preserved.
+ * It is the caller responsibility to remove other flags if needed.
*/
int cs_reset_endp(struct conn_stream *cs)
{
struct cs_endpoint *new_endp;
BUG_ON(!cs->app);
+
+ cs->endp->flags &= ~CS_EP_ERROR;
if (!__cs_endp_target(cs)) {
/* endpoint not attached or attached to a mux with no
* target. Thus the endpoint will not be release but just
cs->endp->flags |= CS_EP_ERROR;
return -1;
}
+ new_endp->flags = cs->endp->flags;
/* The app is still attached, the cs will not be released */
cs_detach_endp(&cs);
req->flags &= ~(CF_WRITE_ERROR | CF_WRITE_TIMEOUT | CF_SHUTW | CF_SHUTW_NOW);
res->flags &= ~(CF_READ_ERROR | CF_READ_TIMEOUT | CF_SHUTR | CF_EOI | CF_READ_NULL | CF_SHUTR_NOW);
res->analysers &= AN_RES_FLT_END;
- cs->endp->flags &= ~CS_EP_RXBLK_SHUT;
s->conn_err_type = STRM_ET_NONE;
s->flags &= ~(SF_CONN_EXP | SF_ERR_MASK | SF_FINST_MASK);
s->conn_exp = TICK_ETERNITY;
s->flags |= SF_ERR_INTERNAL;
return -1;
}
+ cs->endp->flags &= ~CS_EP_RXBLK_SHUT;
b_free(&req->buf);
/* Swap the L7 buffer with the channel buffer */