aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorArthur Dewarumez <arthur.dewarumez@etudiant.univ-lille1.fr>2015-04-30 12:29:58 +0000
committerArthur Dewarumez <arthur.dewarumez@etudiant.univ-lille1.fr>2015-04-30 12:29:58 +0000
commitd0483d2d766ad0b78745058ce46077d267ab5f55 (patch)
tree8cb1c7fd77a75c9b52043da10e35dd239f632066 /src/dht
parent620ca24f5a6835fec7b9b8d77a6e06308e08d2ba (diff)
downloadgnunet-d0483d2d766ad0b78745058ce46077d267ab5f55.tar.gz
gnunet-d0483d2d766ad0b78745058ce46077d267ab5f55.zip
Adding the handle_dht_p2p_trail_destroy function.
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-service-wdht_neighbours.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/dht/gnunet-service-wdht_neighbours.c b/src/dht/gnunet-service-wdht_neighbours.c
index 66e0e8fc3..ba2d4eb63 100644
--- a/src/dht/gnunet-service-wdht_neighbours.c
+++ b/src/dht/gnunet-service-wdht_neighbours.c
@@ -1156,17 +1156,19 @@ handle_dht_p2p_trail_destroy (void *cls,
1156 const struct GNUNET_MessageHeader *message) 1156 const struct GNUNET_MessageHeader *message)
1157{ 1157{
1158 const struct TrailDestroyMessage *tdm; 1158 const struct TrailDestroyMessage *tdm;
1159 struct Trail *trail;
1159 1160
1160 tdm = (const struct TrailDestroyMessage *) message; 1161 tdm = (const struct TrailDestroyMessage *) message;
1161 1162
1162 /* 1163 /* Retreive the trail from the trail_map */
1163 * Steps : 1164 trail = GNUNET_CONTAINER_multihashmap_get(trail_map, tdm->trail_id);
1164 * 1 check if message comme from a trail (that we still remember...) 1165
1165 * 1.a.1 if true: send the destroy message to the rest trail 1166 if(peer == trail->pred_id){
1166 * 1.a.2 clean the trail structure 1167 delete(trail, GNUNET_NO, GNUNET_YES);
1167 * 1.a.3 did i have to remove the trail and ID from the db structure? 1168 }
1168 * 1.b if false: do nothing 1169 else{
1169 */ 1170 delete(trail, GNUNET_YES, GNUNET_NO);
1171 }
1170 1172
1171 return GNUNET_OK; 1173 return GNUNET_OK;
1172} 1174}
@@ -1227,15 +1229,22 @@ handle_dht_p2p_trail_route (void *cls,
1227 const struct GNUNET_MessageHeader *message) 1229 const struct GNUNET_MessageHeader *message)
1228{ 1230{
1229 const struct TrailRouteMessage *trm; 1231 const struct TrailRouteMessage *trm;
1232 const void *payload;
1233 size_t msize;
1234 unsigned int start_payload;
1235
1236 /* msize = ntohs (message->size); */
1237 /* if (msize < sizeof (struct TrailRouteMessage)) */
1238 /* { */
1239 /* GNUNET_break_op (0); */
1240 /* return GNUNET_YES; */
1241 /* } */
1242
1243 /* trm = (const struct TrailRouteMessage *) message; */
1244 /* /\* Retreive payload *\/ */
1245 /* start_payload = sizeof (struct PeerGetResultMessage); */
1246 /* payload = message[start_payload]; */
1230 1247
1231 trm = (const struct TrailRouteMessage *) message;
1232
1233 /*
1234 * Steps :
1235 * 1 check if message comme from a trail
1236 * 1.a.1 if trail not finished with us, continue to forward
1237 * 1.a.2 otherwise handle body message embedded in trail
1238 */
1239 return GNUNET_OK; 1248 return GNUNET_OK;
1240} 1249}
1241 1250