]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] add a new back-reference type : struct bref
authorWilly Tarreau <w@1wt.eu>
Sun, 7 Dec 2008 19:00:15 +0000 (20:00 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 7 Dec 2008 19:00:15 +0000 (20:00 +0100)
This type will be used to maintain back-references to items which
are subject to move between accesses. Typical usage includes session
removal during a listing.

include/common/mini-clist.h

index fca2d76270a9961e244b2621a5f349766e375302..7d16b5e46bc226e3fa3407f4dec7c8099af59cb1 100644 (file)
@@ -19,6 +19,20 @@ struct list {
     struct list *p;    /* prev */
 };
 
+/* a back-ref is a pointer to a target list entry. It is used to detect when an
+ * element being deleted is currently being tracked by another user. The best
+ * example is a user dumping the session table. The table does not fit in the
+ * output buffer so we have to set a mark on a session and go on later. But if
+ * that marked session gets deleted, we don't want the user's pointer to go in
+ * the wild. So we can simply link this user's request to the list of this
+ * session's users, and put a pointer to the list element in ref, that will be
+ * used as the mark for next iteration.
+ */
+struct bref {
+       struct list users;
+       struct list *ref; /* pointer to the target's list entry */
+};
+
 /* First undefine some macros which happen to also be defined on OpenBSD,
  * in sys/queue.h, used by sys/event.h
  */