[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9697 - in GNUnet/src: applications/dv/module util/containe
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9697 - in GNUnet/src: applications/dv/module util/containers |
Date: |
Sat, 5 Dec 2009 01:22:56 +0100 |
Author: nevans
Date: 2009-12-05 01:22:56 +0100 (Sat, 05 Dec 2009)
New Revision: 9697
Modified:
GNUnet/src/applications/dv/module/dv.c
GNUnet/src/util/containers/heap.c
Log:
possible fix for Nils mantis bug regarding my crappy code
Modified: GNUnet/src/applications/dv/module/dv.c
===================================================================
--- GNUnet/src/applications/dv/module/dv.c 2009-12-04 20:56:32 UTC (rev
9696)
+++ GNUnet/src/applications/dv/module/dv.c 2009-12-05 00:22:56 UTC (rev
9697)
@@ -195,7 +195,6 @@
* Why do we check if it is a direct neighbor? delete_neighbor
* only deletes from the extended list anyways...
*/
- GNUNET_mutex_lock (ctx->dvMutex);
if ((GNUNET_NO ==
GNUNET_multi_hash_map_contains (ctx->direct_neighbors,
&neighbor->neighbor->hashPubKey))
@@ -214,7 +213,6 @@
#endif
delete_neighbor (neighbor);
}
- GNUNET_mutex_unlock (ctx->dvMutex);
return GNUNET_OK;
}
@@ -224,8 +222,10 @@
static void
maintain_dv_job (void *unused)
{
+ GNUNET_mutex_lock (ctx->dvMutex);
GNUNET_CONTAINER_heap_iterate (ctx->neighbor_max_heap,
&delete_expired_callback, NULL);
+ GNUNET_mutex_unlock (ctx->dvMutex);
}
/**
@@ -820,6 +820,11 @@
{
ret = GNUNET_NO;
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER |
+ GNUNET_GE_BULK, "Node cost %d too high, not adding this
peer!\n",
+ cost);
+
if ((GNUNET_YES ==
GNUNET_multi_hash_map_contains (ctx->extended_neighbors,
&peer->hashPubKey))
Modified: GNUnet/src/util/containers/heap.c
===================================================================
--- GNUnet/src/util/containers/heap.c 2009-12-04 20:56:32 UTC (rev 9696)
+++ GNUnet/src/util/containers/heap.c 2009-12-05 00:22:56 UTC (rev 9697)
@@ -132,18 +132,22 @@
{
struct GNUNET_CONTAINER_heap_node *ret;
ret = NULL;
- if (node == NULL)
- return NULL;
- if (node->element == element)
- return node;
-
- if (node->left_child != NULL)
- ret = find_element (node->left_child, element);
-
- if (node->right_child != NULL)
- ret = find_element (node->right_child, element);
-
+ if ((node != NULL) && (node->element == element))
+ {
+ ret = node;
+ }
+
+ if ((ret == NULL) && (node != NULL) && (node->left_child != NULL))
+ {
+ ret = find_element (node->left_child, element);
+ }
+
+ if ((ret == NULL) && (node != NULL) && (node->right_child != NULL))
+ {
+ ret = find_element (node->right_child, element);
+ }
+
return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9697 - in GNUnet/src: applications/dv/module util/containers,
gnunet <=