]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: session: add a pointer to the session's origin
authorWilly Tarreau <w@1wt.eu>
Fri, 3 Apr 2015 16:08:29 +0000 (18:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 Apr 2015 09:23:58 +0000 (11:23 +0200)
A session's origin is the entity that was responsible for creating
the session. It can be an applet or a connection for now.

include/types/session.h
src/hlua.c
src/peers.c
src/stream.c

index 8902065b15969a7010b9d991e5ba675bad1c8c3b..6f26ca9944c154b0e1d363299f68d9d7a337b1bb 100644 (file)
@@ -38,6 +38,7 @@
 struct session {
        struct proxy *fe;               /* the proxy this session depends on for the client side */
        struct listener *listener;      /* the listener by which the request arrived */
+       enum obj_type *origin;          /* the connection / applet which initiated this session */
 };
 
 #endif /* _TYPES_SESSION_H */
index 2934054446d972a9da5206e1b0f3e657ef580e73..363c09b28c64ab88dfef1760cde635a36cc28bbc 100644 (file)
@@ -2197,6 +2197,8 @@ __LJMP static int hlua_socket_new(lua_State *L)
                goto out_fail_conn1;
        appctx->ctx.hlua.socket = socket;
        appctx->ctx.hlua.connected = 0;
+       socket->s->sess->origin = &appctx->obj_type;
+
        LIST_INIT(&appctx->ctx.hlua.wake_on_write);
        LIST_INIT(&appctx->ctx.hlua.wake_on_read);
 
index df6d47a1cff8925ffca8658d2f0cc2ac96d0b43f..c27fad048e2450a327f0abe286ae84dfb21895a3 100644 (file)
@@ -1169,6 +1169,7 @@ static struct stream *peer_session_create(struct peer *peer, struct peer_session
                goto out_fail_conn1;
        appctx->st0 = PEER_SESS_ST_CONNECT;
        appctx->ctx.peers.ptr = (void *)ps;
+       s->sess->origin = &appctx->obj_type;
 
        si_reset(&s->si[1]);
 
index 132e425e0ae23c153efb24e4d1bd055132afe60e..357e5615a807d317b6dea68eaaaf2bb30036286e 100644 (file)
@@ -123,6 +123,7 @@ int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
 
        s->sess->listener = l;
        s->sess->fe  = p;
+       s->sess->origin = &cli_conn->obj_type;
 
        s->si[0].flags = SI_FL_NONE;
        s->si[1].flags = SI_FL_ISBACK;