From 0cd2fa7310f1fdf45443a8a9e3335658b1c3c64c Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 25 Dec 2016 18:08:44 -0800 Subject: Substantial fixes for listen & dialers. At this point listening and dialing operations appear to function properly. As part of this I had to break the close logic up since otherwise we had a loop trying to reap a thread from itself. So there is now a separate reaper thread for pipes per-socket. I also changed lists to be a bit more rigid, and allocations now zero memory initially. (We had bugs due to uninitialized memory, and rather than hunt them all down, lets just init them to sane zero values.) --- src/core/list.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/core/list.c') diff --git a/src/core/list.c b/src/core/list.c index 69a74db6..8d6c3ace 100644 --- a/src/core/list.c +++ b/src/core/list.c @@ -58,6 +58,9 @@ nni_list_append(nni_list *list, void *item) { nni_list_node *node = NODE(list, item); + if ((node->ln_next != NULL) || (node->ln_prev != NULL)) { + nni_panic("appending node already on a list or not inited"); + } node->ln_prev = list->ll_head.ln_prev; node->ln_next = &list->ll_head; node->ln_next->ln_prev = node; @@ -70,6 +73,9 @@ nni_list_prepend(nni_list *list, void *item) { nni_list_node *node = NODE(list, item); + if ((node->ln_next != NULL) || (node->ln_prev != NULL)) { + nni_panic("prepending node already on a list or not inited"); + } node->ln_next = list->ll_head.ln_next; node->ln_prev = &list->ll_head; node->ln_next->ln_prev = node; @@ -108,13 +114,6 @@ nni_list_remove(nni_list *list, void *item) node->ln_prev->ln_next = node->ln_next; node->ln_next->ln_prev = node->ln_prev; -} - - -void -nni_list_node_init(nni_list *list, void *item) -{ - nni_list_node *node = NODE(list, item); - - node->ln_prev = node->ln_next = NULL; + node->ln_next = NULL; + node->ln_prev = NULL; } -- cgit v1.2.3-70-g09d2