mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 00:27:08 +02:00
MEDIUM: session: make use of the connection's destroy callback
Now we don't remove the session when a stream dies, instead we detach the stream and let the mux decide to release the connection and call session_free() instead.
This commit is contained in:
parent
4f0c64cad7
commit
3e13cbafe2
@ -73,6 +73,14 @@ void session_free(struct session *sess)
|
|||||||
HA_ATOMIC_SUB(&jobs, 1);
|
HA_ATOMIC_SUB(&jobs, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* callback used from the connection/mux layer to notify that a connection is
|
||||||
|
* gonig to be released.
|
||||||
|
*/
|
||||||
|
void conn_session_free(struct connection *conn)
|
||||||
|
{
|
||||||
|
session_free(conn->owner);
|
||||||
|
}
|
||||||
|
|
||||||
/* 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()
|
||||||
{
|
{
|
||||||
@ -415,6 +423,9 @@ static int conn_complete_session(struct connection *conn)
|
|||||||
task_free(sess->task);
|
task_free(sess->task);
|
||||||
sess->task = NULL;
|
sess->task = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conn_set_owner(conn, sess, conn_session_free);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
@ -394,7 +394,6 @@ static void stream_free(struct stream *s)
|
|||||||
* the stream must free the session.
|
* the stream must free the session.
|
||||||
*/
|
*/
|
||||||
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