MINOR: stream: link the stream to its session

Now each stream is added to the session's list of streams, so that it
will be possible to know all the streams belonging to a session, and
to know if any stream is still attached to a sessoin.
This commit is contained in:
Willy Tarreau 2017-06-27 15:20:05 +02:00
parent bcb86abaca
commit 2bfd35885e
3 changed files with 5 additions and 0 deletions

View File

@ -133,6 +133,7 @@ struct stream {
* This is a bit field of TASK_WOKEN_* */
struct list list; /* position in global streams list */
struct list by_sess; /* position in the session's streams list */
struct list by_srv; /* position in server stream list */
struct list back_refs; /* list of users tracking this stream */
struct buffer_wait buffer_wait; /* position in the list of objects waiting for a buffer */

View File

@ -1856,6 +1856,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
/* Error unrolling */
out_free_strm:
LIST_DEL(&s->by_sess);
LIST_DEL(&s->list);
pool_free2(pool2_stream, s);
out_free_task:

View File

@ -135,6 +135,7 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
/* OK, we're keeping the stream, so let's properly initialize the stream */
LIST_ADDQ(&streams, &s->list);
LIST_ADDQ(&sess->streams, &s->by_sess);
LIST_INIT(&s->back_refs);
LIST_INIT(&s->buffer_wait.list);
@ -249,6 +250,7 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
/* Error unrolling */
out_fail_accept:
flt_stream_release(s, 0);
LIST_DEL(&s->by_sess);
LIST_DEL(&s->list);
pool_free2(pool2_stream, s);
return NULL;
@ -348,6 +350,7 @@ static void stream_free(struct stream *s)
LIST_ADDQ(&LIST_ELEM(s->list.n, struct stream *, list)->back_refs, &bref->users);
bref->ref = s->list.n;
}
LIST_DEL(&s->by_sess);
LIST_DEL(&s->list);
si_release_endpoint(&s->si[1]);
si_release_endpoint(&s->si[0]);