[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9663 - in GNUnet/src: applications/dv/module applications/
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9663 - in GNUnet/src: applications/dv/module applications/dv_dht/tools include util/containers util/network |
Date: |
Wed, 2 Dec 2009 13:43:31 +0100 |
Author: grothoff
Date: 2009-12-02 13:43:31 +0100 (Wed, 02 Dec 2009)
New Revision: 9663
Modified:
GNUnet/src/applications/dv/module/dv.c
GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf
GNUnet/src/include/gnunet_util_containers.h
GNUnet/src/util/containers/heap.c
GNUnet/src/util/network/select.c
Log:
fixing 1517
Modified: GNUnet/src/applications/dv/module/dv.c
===================================================================
--- GNUnet/src/applications/dv/module/dv.c 2009-12-02 11:44:27 UTC (rev
9662)
+++ GNUnet/src/applications/dv/module/dv.c 2009-12-02 12:43:31 UTC (rev
9663)
@@ -1055,8 +1055,7 @@
delete_callback (void *element, GNUNET_CostType cost,
struct GNUNET_CONTAINER_Heap *root, void *cls)
{
- struct GNUNET_dv_neighbor *neighbor;
- neighbor = (struct GNUNET_dv_neighbor *) element;
+ struct GNUNET_dv_neighbor *neighbor = element;
GNUNET_PeerIdentity *toMatch = cls;
#if DEBUG_DV
GNUNET_EncName encNeighbor;
@@ -1086,8 +1085,13 @@
0)))
{
delete_neighbor (neighbor);
+ /* we must not continue iterating at this point since
+ 'delete_neighbor' modified the tree and hence internal
+ invariants of the iterator were likely broken!
+ Besides, each neighbor should only appear once anyway... */
+ return GNUNET_NO;
}
- return GNUNET_OK;
+ return GNUNET_YES;
}
/*
@@ -1129,7 +1133,7 @@
if (neighbor != NULL)
{
GNUNET_CONTAINER_heap_iterate (ctx->neighbor_max_heap,
- &delete_callback, (void *) peer);
+ &delete_callback, peer);
/* Note that we do not use delete_neighbor here because
* we are deleting from the direct neighbor list! */
GNUNET_free (neighbor->neighbor);
Modified: GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf
===================================================================
--- GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf 2009-12-02
11:44:27 UTC (rev 9662)
+++ GNUnet/src/applications/dv_dht/tools/gnunetd_dv.conf 2009-12-02
12:43:31 UTC (rev 9663)
@@ -3,7 +3,7 @@
EXPERIMENTAL = YES
[PATHS]
-GNUNETD_HOME =
+GNUNETD_HOME =/tmp/gnunet-dv-dht-test
[GNUNETD]
APPLICATIONS = advertising getoption topology_default stats dv_dht
Modified: GNUnet/src/include/gnunet_util_containers.h
===================================================================
--- GNUnet/src/include/gnunet_util_containers.h 2009-12-02 11:44:27 UTC (rev
9662)
+++ GNUnet/src/include/gnunet_util_containers.h 2009-12-02 12:43:31 UTC (rev
9663)
@@ -622,8 +622,7 @@
* @param heap - the heap
* @param iterator - function to call on each entry
* @param cls - client argument (closure)
- * @return - number of items handled
- * GNUNET_SYSERR if there's a problem
+ * @return GNUNET_YES if we iterated over all items, otherwise GNUNET_NO
*/
int GNUNET_CONTAINER_heap_iterate (struct GNUNET_CONTAINER_Heap *heap,
GNUNET_CONTAINER_HeapIterator iterator,
Modified: GNUnet/src/util/containers/heap.c
===================================================================
--- GNUnet/src/util/containers/heap.c 2009-12-02 11:44:27 UTC (rev 9662)
+++ GNUnet/src/util/containers/heap.c 2009-12-02 12:43:31 UTC (rev 9663)
@@ -480,16 +480,18 @@
return ret;
}
-void
+int
internal_iterator (struct GNUNET_CONTAINER_Heap *root,
struct GNUNET_CONTAINER_heap_node *node,
GNUNET_CONTAINER_HeapIterator iterator, void *cls)
{
if (node == NULL)
return;
- internal_iterator (root, node->left_child, iterator, cls);
- internal_iterator (root, node->right_child, iterator, cls);
- iterator (node->element, node->cost, root, cls);
+ if (GNUNET_YES != internal_iterator (root, node->left_child, iterator, cls))
+ return;
+ if (GNUNET_YES != internal_iterator (root, node->right_child, iterator, cls))
+ return;
+ return iterator (node->element, node->cost, root, cls);
}
int
@@ -497,8 +499,7 @@
GNUNET_CONTAINER_HeapIterator iterator,
void *cls)
{
- internal_iterator (heap, heap->root, iterator, cls);
- return GNUNET_OK;
+ return internal_iterator (heap, heap->root, iterator, cls);
}
void *
Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c 2009-12-02 11:44:27 UTC (rev 9662)
+++ GNUnet/src/util/network/select.c 2009-12-02 12:43:31 UTC (rev 9663)
@@ -338,8 +338,9 @@
GNUNET_mutex_unlock (sh->lock);
if (GNUNET_OK != sh->mh (sh->mh_cls,
sh, session->sock, session->sock_ctx, pack))
- {
+ {
GNUNET_GE_BREAK(sh->ectx, 0);
+ abort ();
GNUNET_mutex_lock (sh->lock);
if (session->locked == 1)
session->locked = 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9663 - in GNUnet/src: applications/dv/module applications/dv_dht/tools include util/containers util/network,
gnunet <=