MINOR: session: add stick counters to the struct session

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.
This commit is contained in:
Willy Tarreau 2015-04-04 15:58:58 +02:00
parent 11c3624c32
commit b2bf8331fb
5 changed files with 6 additions and 1 deletions

View 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 */

View 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) */

View 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");

View 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");

View 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;