mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
MINOR: session: implement session_free() and use it everywhere
We want to call this one everywhere we have to kill a session so that future parts we move to the session can be released from there.
This commit is contained in:
parent
8d2eca73eb
commit
11c3624c32
@ -31,6 +31,7 @@
|
|||||||
#include <types/session.h>
|
#include <types/session.h>
|
||||||
|
|
||||||
extern struct pool_head *pool2_session;
|
extern struct pool_head *pool2_session;
|
||||||
|
void session_free(struct session *sess);
|
||||||
int init_session();
|
int init_session();
|
||||||
|
|
||||||
#endif /* _PROTO_SESSION_H */
|
#endif /* _PROTO_SESSION_H */
|
||||||
|
@ -2237,7 +2237,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
|
|||||||
out_fail_task:
|
out_fail_task:
|
||||||
pool_free2(pool2_stream, socket->s);
|
pool_free2(pool2_stream, socket->s);
|
||||||
out_fail_stream:
|
out_fail_stream:
|
||||||
pool_free2(pool2_session, sess);
|
session_free(sess);
|
||||||
out_fail_conf:
|
out_fail_conf:
|
||||||
WILL_LJMP(lua_error(L));
|
WILL_LJMP(lua_error(L));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1278,7 +1278,7 @@ static struct stream *peer_session_create(struct peer *peer, struct peer_session
|
|||||||
LIST_DEL(&s->list);
|
LIST_DEL(&s->list);
|
||||||
pool_free2(pool2_stream, s);
|
pool_free2(pool2_stream, s);
|
||||||
out_free_sess:
|
out_free_sess:
|
||||||
pool_free2(pool2_session, sess);
|
session_free(sess);
|
||||||
out_close:
|
out_close:
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
|
|
||||||
struct pool_head *pool2_session;
|
struct pool_head *pool2_session;
|
||||||
|
|
||||||
|
void session_free(struct session *sess)
|
||||||
|
{
|
||||||
|
pool_free2(pool2_session, sess);
|
||||||
|
}
|
||||||
|
|
||||||
/* perform minimal intializations, report 0 in case of error, 1 if OK. */
|
/* perform minimal intializations, report 0 in case of error, 1 if OK. */
|
||||||
int init_session()
|
int init_session()
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,7 @@ int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
|||||||
stream_store_counters(s);
|
stream_store_counters(s);
|
||||||
pool_free2(pool2_stream, s);
|
pool_free2(pool2_stream, s);
|
||||||
out_free_sess:
|
out_free_sess:
|
||||||
pool_free2(pool2_session, sess);
|
session_free(sess);
|
||||||
out_free_conn:
|
out_free_conn:
|
||||||
cli_conn->flags &= ~CO_FL_XPRT_TRACKED;
|
cli_conn->flags &= ~CO_FL_XPRT_TRACKED;
|
||||||
conn_xprt_close(cli_conn);
|
conn_xprt_close(cli_conn);
|
||||||
@ -359,8 +359,8 @@ static void kill_mini_session(struct stream *s)
|
|||||||
/* FIXME: for now we have a 1:1 relation between stream and session so
|
/* FIXME: for now we have a 1:1 relation between stream and session so
|
||||||
* the stream must free the session.
|
* the stream must free the session.
|
||||||
*/
|
*/
|
||||||
pool_free2(pool2_session, sess);
|
|
||||||
pool_free2(pool2_stream, s);
|
pool_free2(pool2_stream, s);
|
||||||
|
session_free(sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish initializing a stream from a connection, or kills it if the
|
/* Finish initializing a stream from a connection, or kills it if the
|
||||||
@ -651,8 +651,8 @@ static void stream_free(struct stream *s)
|
|||||||
/* FIXME: for now we have a 1:1 relation between stream and session so
|
/* FIXME: for now we have a 1:1 relation between stream and session so
|
||||||
* the stream must free the session.
|
* the stream must free the session.
|
||||||
*/
|
*/
|
||||||
pool_free2(pool2_session, s->sess);
|
|
||||||
pool_free2(pool2_stream, s);
|
pool_free2(pool2_stream, s);
|
||||||
|
session_free(sess);
|
||||||
|
|
||||||
/* We may want to free the maximum amount of pools if the proxy is stopping */
|
/* We may want to free the maximum amount of pools if the proxy is stopping */
|
||||||
if (fe && unlikely(fe->state == PR_STSTOPPED)) {
|
if (fe && unlikely(fe->state == PR_STSTOPPED)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user