MINOR: queue: replace the linked list with a tree
We'll need trees to manage the queues by priorities. This change replaces
the list with a tree based on a single key. It's effectively a list but
allows us to get rid of the list management right now.
diff --git a/include/proto/queue.h b/include/proto/queue.h
index 11696db..166da12 100644
--- a/include/proto/queue.h
+++ b/include/proto/queue.h
@@ -52,7 +52,7 @@
*/
static inline void pendconn_cond_unlink(struct pendconn *p)
{
- if (p && !LIST_ISEMPTY(&p->list))
+ if (p && p->node.node.leaf_p)
pendconn_unlink(p);
}
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 234a142..37a5060 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -322,7 +322,7 @@
int serverfin; /* timeout to apply to server half-closed connections */
} timeout;
char *id, *desc; /* proxy id (name) and description */
- struct list pendconns; /* pending connections with no server assigned yet */
+ struct eb_root pendconns; /* pending connections with no server assigned yet */
int nbpend; /* number of pending connections with no server assigned yet */
int totpend; /* total number of pending connections on this instance (for stats) */
unsigned int queue_idx; /* number of pending connections which have been de-queued */
diff --git a/include/types/queue.h b/include/types/queue.h
index 575cc59..361c704 100644
--- a/include/types/queue.h
+++ b/include/types/queue.h
@@ -37,7 +37,7 @@
struct proxy *px;
struct server *srv; /* the server we are waiting for, may be NULL if don't care */
struct server *target; /* the server that was assigned, = srv except if srv==NULL */
- struct list list; /* next pendconn */
+ struct eb32_node node;
};
#endif /* _TYPES_QUEUE_H */
diff --git a/include/types/server.h b/include/types/server.h
index 7d0ba45..8825928 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -215,7 +215,7 @@
struct freq_ctr sess_per_sec; /* sessions per second on this server */
struct be_counters counters; /* statistics counters */
- struct list pendconns; /* pending connections */
+ struct eb_root pendconns; /* pending connections */
struct list actconns; /* active connections */
struct list *priv_conns; /* private idle connections attached to stream interfaces */
struct list *idle_conns; /* sharable idle connections attached or not to a stream interface */