aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amat.us>2017-12-27 18:35:48 -0600
committerDavid Barksdale <amatus@amat.us>2017-12-27 18:35:48 -0600
commitf4f75ed70d46464bf613d87d71552770fab8b6bf (patch)
tree0c66f976128e2823f432e16531267d459ef2a2ca /src/cadet
parent012cae139ac7c647b1807f62b64e8b59dafe712b (diff)
downloadgnunet-f4f75ed70d46464bf613d87d71552770fab8b6bf.tar.gz
gnunet-f4f75ed70d46464bf613d87d71552770fab8b6bf.zip
Better cycle checking in path from DHT
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_paths.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c
index 7b90fe152..0ec7ff3d7 100644
--- a/src/cadet/gnunet-service-cadet_paths.c
+++ b/src/cadet/gnunet-service-cadet_paths.c
@@ -501,6 +501,14 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
501 pid = (off < get_path_length) 501 pid = (off < get_path_length)
502 ? &get_path[get_path_length - off - 1] 502 ? &get_path[get_path_length - off - 1]
503 : &put_path[get_path_length + put_path_length - off - 1]; 503 : &put_path[get_path_length + put_path_length - off - 1];
504 /* Check that I am not in the path */
505 if (0 == memcmp (&my_full_id,
506 pid,
507 sizeof (struct GNUNET_PeerIdentity)))
508 {
509 skip = off + 1;
510 continue;
511 }
504 cpath[off - skip] = GCP_get (pid, 512 cpath[off - skip] = GCP_get (pid,
505 GNUNET_YES); 513 GNUNET_YES);
506 /* Check that no peer is twice on the path */ 514 /* Check that no peer is twice on the path */
@@ -513,6 +521,12 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path,
513 } 521 }
514 } 522 }
515 } 523 }
524 if (skip >= total_len)
525 {
526 LOG (GNUNET_ERROR_TYPE_DEBUG,
527 "Path discovered from DHT is one big cycle?\n");
528 return;
529 }
516 total_len -= skip; 530 total_len -= skip;
517 531
518 /* First figure out if this path is a subset of an existing path, an 532 /* First figure out if this path is a subset of an existing path, an