diff options
Diffstat (limited to 'src/dht/gnunet-service-xdht_routing.c')
-rw-r--r-- | src/dht/gnunet-service-xdht_routing.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/dht/gnunet-service-xdht_routing.c b/src/dht/gnunet-service-xdht_routing.c index 15a492dc5..d81b79f43 100644 --- a/src/dht/gnunet-service-xdht_routing.c +++ b/src/dht/gnunet-service-xdht_routing.c | |||
@@ -92,25 +92,25 @@ GDS_ROUTING_add (struct GNUNET_PeerIdentity *source, | |||
92 | struct GNUNET_PeerIdentity *prev_hop, | 92 | struct GNUNET_PeerIdentity *prev_hop, |
93 | struct GNUNET_PeerIdentity *next_hop) | 93 | struct GNUNET_PeerIdentity *next_hop) |
94 | { | 94 | { |
95 | struct RoutingTrail *new_routing_entry; | 95 | struct RoutingTrail *new_routing_entry; |
96 | 96 | ||
97 | new_routing_entry = GNUNET_malloc (sizeof (struct RoutingTrail)); | 97 | new_routing_entry = GNUNET_malloc (sizeof (struct RoutingTrail)); |
98 | new_routing_entry->source = source; | 98 | new_routing_entry->source = source; |
99 | new_routing_entry->previous_hop = prev_hop; | 99 | new_routing_entry->previous_hop = prev_hop; |
100 | new_routing_entry->next_hop = next_hop; | 100 | new_routing_entry->next_hop = next_hop; |
101 | new_routing_entry->destination = dest; | 101 | new_routing_entry->destination = dest; |
102 | 102 | ||
103 | /* If dest is already present in the routing table, then exit.*/ | 103 | /* If dest is already present in the routing table, then exit.*/ |
104 | if (GNUNET_YES == | 104 | if (GNUNET_YES == |
105 | GNUNET_CONTAINER_multipeermap_contains (routing_table, | 105 | GNUNET_CONTAINER_multipeermap_contains (routing_table, |
106 | dest)) | 106 | dest)) |
107 | { | 107 | { |
108 | GNUNET_break (0); | 108 | GNUNET_break (0); |
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | 111 | ||
112 | GNUNET_assert (GNUNET_OK == | 112 | GNUNET_assert (GNUNET_OK == |
113 | GNUNET_CONTAINER_multipeermap_put (routing_table, | 113 | GNUNET_CONTAINER_multipeermap_put (routing_table, |
114 | dest, new_routing_entry, | 114 | dest, new_routing_entry, |
115 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 115 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
116 | } | 116 | } |
@@ -125,13 +125,13 @@ GDS_Routing_search(struct GNUNET_PeerIdentity *source_peer, | |||
125 | struct GNUNET_PeerIdentity *destination_peer, | 125 | struct GNUNET_PeerIdentity *destination_peer, |
126 | struct GNUNET_PeerIdentity *prev_hop) | 126 | struct GNUNET_PeerIdentity *prev_hop) |
127 | { | 127 | { |
128 | struct RoutingTrail *trail; | 128 | struct RoutingTrail *trail; |
129 | trail = (struct RoutingTrail *)(GNUNET_CONTAINER_multipeermap_get(routing_table,destination_peer)); | 129 | trail = (struct RoutingTrail *)(GNUNET_CONTAINER_multipeermap_get(routing_table,destination_peer)); |
130 | 130 | ||
131 | if(trail == NULL) | 131 | if(trail == NULL) |
132 | return NULL; | 132 | return NULL; |
133 | 133 | ||
134 | return trail->next_hop; | 134 | return trail->next_hop; |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
@@ -161,6 +161,7 @@ GDS_ROUTING_process (enum GNUNET_BLOCK_Type type, | |||
161 | const struct GNUNET_PeerIdentity *get_path, | 161 | const struct GNUNET_PeerIdentity *get_path, |
162 | const void *data, size_t data_size) | 162 | const void *data, size_t data_size) |
163 | { | 163 | { |
164 | |||
164 | } | 165 | } |
165 | 166 | ||
166 | 167 | ||
@@ -169,7 +170,7 @@ GDS_ROUTING_process (enum GNUNET_BLOCK_Type type, | |||
169 | */ | 170 | */ |
170 | void | 171 | void |
171 | GDS_ROUTING_init () | 172 | GDS_ROUTING_init () |
172 | { | 173 | { |
173 | routing_table = GNUNET_CONTAINER_multipeermap_create (DHT_MAX_RECENT * 4 / 3, GNUNET_NO); | 174 | routing_table = GNUNET_CONTAINER_multipeermap_create (DHT_MAX_RECENT * 4 / 3, GNUNET_NO); |
174 | } | 175 | } |
175 | 176 | ||