/*----- doubly linked lists -----*/
#define ISNODE(T) struct { T *succ, *pred; } node /* must be at start */
-#define DEFLIST(T) typedef struct { T *head, *tail, *tp; int count; } T##List
+#define DEFLIST(T) typedef struct { T *hd, *tl, *tp; int count; } T##List
#define NODE(n) (assert((void*)&(n)->node == &(n)), \
(struct node*)&(n)->node)
#define LIST_CHECKCANHAVENODE(l,n) \
- ((void)((n) == ((l).head))) /* just for the type check */
+ ((void)((n) == ((l).hd))) /* just for the type check */
#define LIST_ADDSOMEHOW(l,n,list_addsomehow) \
( LIST_CHECKCANHAVENODE(l,n), \
)
#define LIST_REMSOMEHOW(l,list_remsomehow) \
- ( (typeof((l).head)) \
+ ( (typeof((l).hd)) \
( (l).count \
? ( (l).count--, \
list_remsomehow((struct list*)&(l)) ) \
#define LIST_REMHEAD(l) LIST_REMSOMEHOW((l),list_remhead)
#define LIST_REMTAIL(l) LIST_REMSOMEHOW((l),list_remtail)
+#define LIST_HEAD(l) ((typeof((l)->hd))(list_head((struct list*)&(l))))
+#define LIST_NEXT(n) ((typeof(n))list_succ(NODE((n))))
+#define LIST_BACK(n) ((typeof(n))list_pred(NODE((n))))
+
#define LIST_REMOVE(l,n) \
( LIST_CHECKCANHAVENODE(l,n), \
list_remove(NODE((n))), \
static oop_source *loop;
-static int nconns, until_connect;
-static ConnList idle, working, full;
+static int until_connect;
+static ConnList conns;
static ArticleList queue;
static char *path_lock, *path_flushing, *path_defer;
/* Phew! */
setnonblock(conn->fd, 1);
conn->max_queue= conn->stream ? max_queue_per_conn : 1;
- LIST_ADDHEAD(idle, conn);
+ LIST_ADDHEAD(conns, conn);
notice("#%d connected %s", conn->fd, conn->stream ? "streaming" : "plain");
connect_attempt_discard();
check_master_queue();