[MINOR] add back-references to sessions for later use by a dumper.

This is the first step in implementing a session dump tool.
A session dump will need restart points. It will be necessary for
it to get references to sessions which can be moved when the session
dies.

The principle is not that complex : when a session ends, it looks for
any potential back-references. If it finds any, then it moves them to
the next session in the list. The dump function will of course have
to restart from that new point.
diff --git a/src/proto_uxst.c b/src/proto_uxst.c
index 06ec185..2543268 100644
--- a/src/proto_uxst.c
+++ b/src/proto_uxst.c
@@ -360,6 +360,7 @@
 	struct listener *l = fdtab[fd].owner;
 	struct session *s;
 	struct task *t;
+	struct bref *bref, *back;
 	int cfd;
 	int max_accept;
 
@@ -409,6 +410,7 @@
 		}
 
 		LIST_ADDQ(&sessions, &s->list);
+		LIST_INIT(&s->back_refs);
 
 		s->flags = 0;
 		s->term_trace = 0;
@@ -545,6 +547,11 @@
  out_free_task:
 	pool_free2(pool2_task, t);
  out_free_session:
+	list_for_each_entry_safe(bref, back, &s->back_refs, users) {
+		LIST_DEL(&bref->users);
+		LIST_ADDQ(&LIST_ELEM(s->list.n, struct session *, list)->back_refs, &bref->users);
+		bref->ref = s->list.n;
+	}
 	LIST_DEL(&s->list);
 	pool_free2(pool2_session, s);
  out_close: