]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: session: add stick counters to the struct session
authorWilly Tarreau <w@1wt.eu>
Sat, 4 Apr 2015 13:58:58 +0000 (15:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 Apr 2015 09:37:30 +0000 (11:37 +0200)
The stick counters in the session will be used for everything not related
to contents, hence the connections / concurrent sessions / etc. They will
be usable by "tcp-request connection" rules even without a stream. For now
they're just allocated and initialized.

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

index e4e393b1012a57378c3e3057e7829833885d3c84..45d2df1fbb77a2fbef0460367d66a9f0aa26ca1a 100644 (file)
@@ -41,6 +41,7 @@ struct session {
        enum obj_type *origin;          /* the connection / applet which initiated this session */
        struct timeval accept_date;     /* date of the session's accept() in user date */
        struct timeval tv_accept;       /* date of the session's accept() in internal date (monotonic) */
+       struct stkctr stkctr[MAX_SESS_STKCTR];  /* stick counters for tcp-connection */
 };
 
 #endif /* _TYPES_SESSION_H */
index b83f65588c88f6473e3b0eb3ae81a912f7ddcfca..be285683d6a04b4f751a4cc3e18c1588a286f772 100644 (file)
@@ -139,7 +139,7 @@ struct stream {
        int store_count;
        /* 4 unused bytes here */
 
-       struct stkctr stkctr[MAX_SESS_STKCTR];  /* stick counters */
+       struct stkctr stkctr[MAX_SESS_STKCTR];  /* content-aware stick counters */
 
        char **req_cap;                         /* array of captures from the request (may be NULL) */
        char **res_cap;                         /* array of captures from the response (may be NULL) */
index 7df8778eb76f202f4193a51278a44eef0b7d74ab..cbc0fdedd6cc31c55b6d4e49f86aa33818f9569b 100644 (file)
@@ -2035,6 +2035,8 @@ __LJMP static int hlua_socket_new(lua_State *L)
 
        sess->accept_date = date; /* user-visible date for logging */
        sess->tv_accept   = now;  /* corrected date for internal use */
+       memset(sess->stkctr, 0, sizeof(sess->stkctr));
+
        socket->s = pool_alloc2(pool2_stream);
        if (!socket->s) {
                hlua_pusherror(L, "socket: out of memory");
index df4ecf88930b079ec21653f63b6f391aaf8f108b..57954d74a049680ddaa2eca52c0a1f05bbe34303 100644 (file)
@@ -1127,6 +1127,7 @@ static struct stream *peer_session_create(struct peer *peer, struct peer_session
        sess->fe = p;
        sess->accept_date = date; /* user-visible date for logging */
        sess->tv_accept = now;  /* corrected date for internal use */
+       memset(sess->stkctr, 0, sizeof(sess->stkctr));
 
        if ((s = pool_alloc2(pool2_stream)) == NULL) { /* disable this proxy for a while */
                Alert("out of memory in peer_session_create().\n");
index 6730ad47de9619d31b9a3e6338fe9e8773f92c8c..e21a2a5834e47d89b8327f4e8beeccccb810e3b1 100644 (file)
@@ -107,6 +107,7 @@ int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        sess->origin = &cli_conn->obj_type;
        sess->accept_date = date; /* user-visible date for logging */
        sess->tv_accept   = now;  /* corrected date for internal use */
+       memset(sess->stkctr, 0, sizeof(sess->stkctr));
 
        if (unlikely((s = pool_alloc2(pool2_stream)) == NULL))
                goto out_free_sess;