[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33882 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33882 - gnunet/src/dht |
Date: |
Fri, 27 Jun 2014 17:01:19 +0200 |
Author: supriti
Date: 2014-06-27 17:01:19 +0200 (Fri, 27 Jun 2014)
New Revision: 33882
Modified:
gnunet/src/dht/gnunet-service-xdht_datacache.c
gnunet/src/dht/gnunet-service-xdht_neighbours.c
gnunet/src/dht/gnunet-service-xdht_routing.c
gnunet/src/dht/gnunet-service-xdht_routing.h
gnunet/src/dht/gnunet_dht_profiler.c
Log:
xvine: bug fixes
Modified: gnunet/src/dht/gnunet-service-xdht_datacache.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_datacache.c 2014-06-27 12:30:52 UTC
(rev 33881)
+++ gnunet/src/dht/gnunet-service-xdht_datacache.c 2014-06-27 15:01:19 UTC
(rev 33882)
@@ -195,7 +195,7 @@
{
struct GetRequestContext *ctx = cls;
enum GNUNET_BLOCK_EvaluationResult eval;
- FPRINTF (stderr,_("\nSUPU %s, %s, %d"),__FILE__, __func__,__LINE__);
+
eval =
GNUNET_BLOCK_evaluate (GDS_block_context, type, key, ctx->reply_bf,
ctx->reply_bf_mutator, ctx->xquery,
Modified: gnunet/src/dht/gnunet-service-xdht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_neighbours.c 2014-06-27 12:30:52 UTC
(rev 33881)
+++ gnunet/src/dht/gnunet-service-xdht_neighbours.c 2014-06-27 15:01:19 UTC
(rev 33882)
@@ -1081,7 +1081,7 @@
peer_list = (struct GNUNET_PeerIdentity *) &tsm[1];
memcpy (peer_list, trail_peer_list, trail_length * sizeof(struct
GNUNET_PeerIdentity));
}
-
+
GNUNET_CONTAINER_DLL_insert_tail (target_friend->head, target_friend->tail,
pending);
target_friend->pending_count++;
process_friend_queue (target_friend);
@@ -2138,7 +2138,7 @@
put_path_length = 0;
msize = data_size + sizeof (struct PeerPutMessage);
}
-
+
if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
@@ -2357,7 +2357,7 @@
msize = (put_path_length + get_path_length )* sizeof (struct
GNUNET_PeerIdentity) +
data_size +
sizeof (struct PeerGetResultMessage);
-
+
if (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
@@ -2614,7 +2614,7 @@
/* Send trail teardown message across the replaced trail. */
struct Trail *replace_trail =
&existing_finger->trail_list[largest_trail_index];
- GDS_ROUTING_remove_trail (replace_trail->trail_id);
+ GNUNET_assert (GNUNET_YES == GDS_ROUTING_remove_trail
(replace_trail->trail_id));
GDS_NEIGHBOURS_send_trail_teardown (replace_trail->trail_id,
GDS_ROUTING_SRC_TO_DEST,
replace_trail->trail_head->peer);
@@ -2776,16 +2776,17 @@
GNUNET_CONTAINER_multipeermap_get (friend_peermap,
&trail->trail_head->peer)));
else
+ {
GNUNET_assert (NULL != (friend =
GNUNET_CONTAINER_multipeermap_get (friend_peermap,
&finger->finger_identity)));
-
+ }
GNUNET_assert (0 == GNUNET_CRYPTO_cmp_peer_identity (next_hop, &friend->id));
- GDS_ROUTING_remove_trail (trail->trail_id);
+ GNUNET_assert (GNUNET_YES == GDS_ROUTING_remove_trail (trail->trail_id));
friend->trails_count--;
GDS_NEIGHBOURS_send_trail_teardown (trail->trail_id,
GDS_ROUTING_SRC_TO_DEST,
- trail->trail_head->peer);
+ friend->id);
}
@@ -3029,6 +3030,9 @@
(target_friend =
GNUNET_CONTAINER_multipeermap_get (friend_peermap,
&trail[0])));
+ GNUNET_assert (NULL !=
+ (GNUNET_CONTAINER_multipeermap_get (friend_peermap,
+ &trail[i])));
GDS_ROUTING_update_trail_next_hop (trail_id, trail[i]);
GDS_NEIGHBOURS_send_trail_compression (my_identity,
trail_id, trail[i],
@@ -3796,6 +3800,9 @@
/* Are we just a part of a trail towards a finger (current_destination)? */
if (0 != (GNUNET_CRYPTO_cmp_peer_identity (&my_identity, current_dest)))
{
+ struct GNUNET_PeerIdentity print_peer;
+ memcpy(&print_peer, current_dest, sizeof (struct GNUNET_PeerIdentity));
+
struct GNUNET_PeerIdentity *closest_peer;
/* Select best successor among one found locally and current_destination
@@ -3812,7 +3819,7 @@
{
struct GNUNET_PeerIdentity *next_hop;
next_hop = GDS_ROUTING_get_next_hop (intermediate_trail_id,
- GDS_ROUTING_SRC_TO_DEST);
+ GDS_ROUTING_SRC_TO_DEST);
/* FIXME: Here we found next_hop NULL from routing table, but we still
* have a next_hop from find_successor should we not break and choose
that
* next_hop. */
@@ -4804,13 +4811,7 @@
/* I am the new_successor to source_peer. */
if ( 0 == GNUNET_CRYPTO_cmp_peer_identity (&my_identity, &new_successor))
{
- /* Add an entry in routing table only if new predecessor is not a friend.
*/
- if (NULL == GNUNET_CONTAINER_multipeermap_get(friend_peermap, &source))
- {
- /* FIXME: check that you always add trail entry even if your finger is
- friend. */
- GDS_ROUTING_add (trail_id, *peer, my_identity);
- }
+ GDS_ROUTING_add (trail_id, *peer, my_identity);
compare_and_update_predecessor (source, trail, trail_length);
return GNUNET_OK;
}
@@ -4826,8 +4827,7 @@
next_hop = new_successor;
else
next_hop = trail[my_index + 1];
- /* FIXME: check that you always add trail entry even if your finger is
- friend. */
+
/* Add an entry in routing table for trail from source to its new successor.
*/
GNUNET_assert (GNUNET_OK == GDS_ROUTING_add (trail_id, *peer, next_hop));
GNUNET_assert (NULL !=
@@ -4968,15 +4968,9 @@
{
/* Add an entry in routing table only
* 1. If I am not the original source which sent the request for trail
setup
- * 2. If trail length > 0.
- * NOTE: In case trail length > 0 and source is my friend, then also I add
- * an entry in routing table,as we will send a trail compression
message
- * later.
- */
- /* FIXME: check that you always add trail entry even if your finger is
+ FIXME: check that you always add trail entry even if your finger is
friend. */
- if ((0 != GNUNET_CRYPTO_cmp_peer_identity (&source, &my_identity)) ||
- (trail_length > 0))
+ if (0 != GNUNET_CRYPTO_cmp_peer_identity (&source, &my_identity))
GNUNET_assert (GNUNET_YES == GDS_ROUTING_add (trail_id, *peer,
my_identity));
if (0 == trail_length)
@@ -5054,9 +5048,11 @@
if (0 == (GNUNET_CRYPTO_cmp_peer_identity
(&(trail_compression->new_first_friend),
&my_identity)))
{
+ GNUNET_assert (NULL != GNUNET_CONTAINER_multipeermap_get (friend_peermap,
&trail_compression->source_peer));
/* Update your prev hop to source of this message. */
- GDS_ROUTING_update_trail_prev_hop (trail_id,
- trail_compression->source_peer);
+ GNUNET_assert (GNUNET_SYSERR !=
+ (GDS_ROUTING_update_trail_prev_hop (trail_id,
+
trail_compression->source_peer)));
return GNUNET_OK;
}
//GDS_ROUTING_test_print();
@@ -5094,9 +5090,9 @@
const struct PeerTrailTearDownMessage *trail_teardown;
enum GDS_ROUTING_trail_direction trail_direction;
struct GNUNET_HashCode trail_id;
- //struct GNUNET_PeerIdentity *prev_hop;
struct GNUNET_PeerIdentity *next_hop;
size_t msize;
+
msize = ntohs (message->size);
/* Here we pass only the trail id. */
@@ -5122,23 +5118,29 @@
return GNUNET_SYSERR;
}
#endif
+
+ next_hop = GDS_ROUTING_get_next_hop (trail_id, trail_direction);
- next_hop = GDS_ROUTING_get_next_hop (trail_id, trail_direction);
if (NULL == next_hop)
{
GNUNET_break (0);
return GNUNET_SYSERR;
}
-
+
GNUNET_assert (GNUNET_YES == GDS_ROUTING_remove_trail (trail_id));
- /* If next_hop is my_identity, it means I am the final destination. */
+ /* I am the next hop, which means I am the final destination. */
if (0 == GNUNET_CRYPTO_cmp_peer_identity (next_hop, &my_identity))
+ {
return GNUNET_OK;
+ }
+ else
+ {
+ /* If not final destination, then send a trail teardown message to next
hop.*/
+ GNUNET_assert (NULL != GNUNET_CONTAINER_multipeermap_get (friend_peermap,
next_hop));
+ GDS_NEIGHBOURS_send_trail_teardown (trail_id, trail_direction, *next_hop);
+ }
- /* If not final destination, then send a trail teardown message to next
hop.*/
- GDS_NEIGHBOURS_send_trail_teardown (trail_id, trail_direction, *next_hop);
- //GNUNET_free_non_null (next_hop);
return GNUNET_OK;
}
@@ -5202,7 +5204,7 @@
/* Get my location in the trail. */
my_index = search_my_index (trail, trail_length);
- if (GNUNET_SYSERR == my_index)
+ if (-1 == my_index)
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -5279,7 +5281,7 @@
GNUNET_assert (0 == (GNUNET_CRYPTO_cmp_peer_identity
(disconnected_friend,
next_hop)));
matching_trails_count++;
- GDS_ROUTING_remove_trail (trail->trail_id);
+ GNUNET_assert (GNUNET_YES == GDS_ROUTING_remove_trail (trail->trail_id));
free_trail (trail);
trail->is_present = GNUNET_NO;
@@ -5345,7 +5347,7 @@
GNUNET_assert (0 ==
(GNUNET_CRYPTO_cmp_peer_identity (next_hop,
&remove_finger->finger_identity)));
- GDS_ROUTING_remove_trail (trail_id);
+ GNUNET_assert (GNUNET_YES == GDS_ROUTING_remove_trail (trail_id));
remove_friend = GNUNET_CONTAINER_multipeermap_get (friend_peermap,
disconnected_peer);
remove_friend->trails_count--;
@@ -5400,7 +5402,7 @@
/* Remove any trail from routing table of which peer is a part of. This
function
* internally sends a trail teardown message in the direction of which
* disconnected peer is not part of. */
- GDS_ROUTING_remove_trail_by_peer (peer);
+ GNUNET_assert (GNUNET_SYSERR != GDS_ROUTING_remove_trail_by_peer (peer));
GNUNET_assert (0 == remove_friend->trails_count);
Modified: gnunet/src/dht/gnunet-service-xdht_routing.c
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_routing.c 2014-06-27 12:30:52 UTC
(rev 33881)
+++ gnunet/src/dht/gnunet-service-xdht_routing.c 2014-06-27 15:01:19 UTC
(rev 33882)
@@ -48,6 +48,7 @@
#define ROUTING_TABLE_THRESHOLD 64
/**
+ * FIXME: Store friend pointer instead of peer identifier.
* Routing table entry .
*/
struct RoutingTrail
@@ -264,20 +265,24 @@
}
}
#endif
+
/**
* Remove every trail where peer is either next_hop or prev_hop. Also send a
* trail teardown message in direction of hop which is not disconnected.
* @param peer Peer identity. Trail containing this peer should be removed.
*/
-void
+int
GDS_ROUTING_remove_trail_by_peer (const struct GNUNET_PeerIdentity *peer)
{
+ int ret;
/* No entries in my routing table. */
if (0 == GNUNET_CONTAINER_multihashmap_size(routing_table))
- return;
+ return GNUNET_YES;
- GNUNET_CONTAINER_multihashmap_iterate (routing_table,
&remove_matching_trails,
- (void *)peer);
+ ret = GNUNET_CONTAINER_multihashmap_iterate (routing_table,
+ &remove_matching_trails,
+ (void *)peer);
+ return ret;
}
Modified: gnunet/src/dht/gnunet-service-xdht_routing.h
===================================================================
--- gnunet/src/dht/gnunet-service-xdht_routing.h 2014-06-27 12:30:52 UTC
(rev 33881)
+++ gnunet/src/dht/gnunet-service-xdht_routing.h 2014-06-27 15:01:19 UTC
(rev 33882)
@@ -80,7 +80,7 @@
* Remove every trail where peer is either next_hop or prev_hop
* @param peer Peer to be searched.
*/
-void
+int
GDS_ROUTING_remove_trail_by_peer (const struct GNUNET_PeerIdentity *peer);
/**
* Remove trail with trail_id
@@ -134,4 +134,5 @@
*/
void
GDS_ROUTING_done (void);
+
#endif
\ No newline at end of file
Modified: gnunet/src/dht/gnunet_dht_profiler.c
===================================================================
--- gnunet/src/dht/gnunet_dht_profiler.c 2014-06-27 12:30:52 UTC (rev
33881)
+++ gnunet/src/dht/gnunet_dht_profiler.c 2014-06-27 15:01:19 UTC (rev
33882)
@@ -307,6 +307,8 @@
struct ActiveContext *ac = cls;
struct ActiveContext *get_ac = ac->get_ac;
+ /* FIXME: Compare the keys of put and the result. */
+
if (get_ac->put_data_size != size)
{
DEBUG ("Found a GET with incorrect data length (this may happen, but very
unlikely)\n");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33882 - gnunet/src/dht,
gnunet <=