chiark
/
gitweb
/
~ian
/
innduct.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip make it compile; mid eliminate multiple conn lists
[innduct.git]
/
backends
/
innduct.c
diff --git
a/backends/innduct.c
b/backends/innduct.c
index a2b3742b47ef924ff6675780ea744926cd1a101a..9ee13bc7d372cfd774a67f086ada6c5af9e88f54 100644
(file)
--- a/
backends/innduct.c
+++ b/
backends/innduct.c
@@
-187,13
+187,13
@@
perl -ne 'print if m/-8\<-/..m/-\>8-/; print "\f" if m/-\^L-/' backends/innduct.
/*----- doubly linked lists -----*/
#define ISNODE(T) struct { T *succ, *pred; } node /* must be at start */
/*----- doubly linked lists -----*/
#define ISNODE(T) struct { T *succ, *pred; } node /* must be at start */
-#define DEFLIST(T) typedef struct { T *h
ead, *tai
l, *tp; int count; } T##List
+#define DEFLIST(T) typedef struct { T *h
d, *t
l, *tp; int count; } T##List
#define NODE(n) (assert((void*)&(n)->node == &(n)), \
(struct node*)&(n)->node)
#define LIST_CHECKCANHAVENODE(l,n) \
#define NODE(n) (assert((void*)&(n)->node == &(n)), \
(struct node*)&(n)->node)
#define LIST_CHECKCANHAVENODE(l,n) \
- ((void)((n) == ((l).h
ea
d))) /* 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_ADDSOMEHOW(l,n,list_addsomehow) \
( LIST_CHECKCANHAVENODE(l,n), \
@@
-202,7
+202,7
@@
perl -ne 'print if m/-8\<-/..m/-\>8-/; print "\f" if m/-\^L-/' backends/innduct.
)
#define LIST_REMSOMEHOW(l,list_remsomehow) \
)
#define LIST_REMSOMEHOW(l,list_remsomehow) \
- ( (typeof((l).h
ead))
\
+ ( (typeof((l).h
d))
\
( (l).count \
? ( (l).count--, \
list_remsomehow((struct list*)&(l)) ) \
( (l).count \
? ( (l).count--, \
list_remsomehow((struct list*)&(l)) ) \
@@
-216,6
+216,10
@@
perl -ne 'print if m/-8\<-/..m/-\>8-/; print "\f" if m/-\^L-/' backends/innduct.
#define LIST_REMHEAD(l) LIST_REMSOMEHOW((l),list_remhead)
#define LIST_REMTAIL(l) LIST_REMSOMEHOW((l),list_remtail)
#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))), \
#define LIST_REMOVE(l,n) \
( LIST_CHECKCANHAVENODE(l,n), \
list_remove(NODE((n))), \
@@
-397,8
+401,8
@@
struct Conn {
static oop_source *loop;
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;
static ArticleList queue;
static char *path_lock, *path_flushing, *path_defer;
@@
-710,7
+714,7
@@
static void *connchild_event(oop_source *lp, int fd, oop_event e, void *u) {
/* Phew! */
setnonblock(conn->fd, 1);
conn->max_queue= conn->stream ? max_queue_per_conn : 1;
/* 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();
notice("#%d connected %s", conn->fd, conn->stream ? "streaming" : "plain");
connect_attempt_discard();
check_master_queue();