#include <haproxy/obj_type-t.h>
#include <haproxy/connection-t.h>
#include <haproxy/show_flags-t.h>
+#include <haproxy/xref-t.h>
/* Stream Endpoint Flags.
* Please also update the se_show_flags() function below in case of changes.
* <lra> is the last read activity
* <fsb> is the first send blocked
* <flags> SE_FL_*
+ * <xref> cross reference with the opposite SC
*
* <lra> should be updated when a read activity is detected. It can be a
* successful receive, when a shutr is reported or when receives are
unsigned int flags;
unsigned int lra;
unsigned int fsb;
+ struct xref xref;
};
/* sc_app_ops describes the application layer's operations and notification
#include <haproxy/pool.h>
#include <haproxy/sc_strm.h>
#include <haproxy/stconn.h>
+#include <haproxy/xref.h>
DECLARE_POOL(pool_head_connstream, "stconn", sizeof(struct stconn));
DECLARE_POOL(pool_head_sedesc, "sedesc", sizeof(struct sedesc));
sedesc->sc = NULL;
sedesc->lra = TICK_ETERNITY;
sedesc->fsb = TICK_ETERNITY;
+ sedesc->xref.peer = NULL;
se_fl_setall(sedesc, SE_FL_NONE);
}
}
sc->app_ops = &sc_app_conn_ops;
+ xref_create(&sc->sedesc->xref, &sc_opposite(sc)->sedesc->xref);
}
else if (sc_check(sc)) {
if (!sc->wait_event.tasklet) {
sc->sedesc->se = sd;
sc_ep_set(sc, SE_FL_T_APPLET);
sc_ep_clr(sc, SE_FL_DETACHED);
- if (sc_strm(sc))
+ if (sc_strm(sc)) {
sc->app_ops = &sc_app_applet_ops;
+ xref_create(&sc->sedesc->xref, &sc_opposite(sc)->sedesc->xref);
+ }
}
/* Attaches a stconn to a app layer and sets the relevant
if (!sc)
return;
+ if (sc->sedesc) {
+ struct xref *peer;
+
+ /* Remove my link in the original objects. */
+ peer = xref_get_peer_and_lock(&sc->sedesc->xref);
+ if (peer)
+ xref_disconnect(&sc->sedesc->xref, peer);
+ }
+
if (sc_ep_test(sc, SE_FL_T_MUX)) {
struct connection *conn = __sc_conn(sc);
struct sedesc *sedesc = sc->sedesc;