aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/cadet_api.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2018-06-25 23:46:01 +0200
committert3sserakt <t3ss@posteo.de>2018-06-25 23:46:01 +0200
commit1aac0fdeaa4af2c7b14b81f0a90f0465b9c681f4 (patch)
treec965610083cc4079d812b9c78165995177d78fb2 /src/cadet/cadet_api.c
parent23644d2ef3a3c0299b681e68a7122bc5becff322 (diff)
downloadgnunet-1aac0fdeaa4af2c7b14b81f0a90f0465b9c681f4.tar.gz
gnunet-1aac0fdeaa4af2c7b14b81f0a90f0465b9c681f4.zip
bug 5228: made gnunet-cadet -p work as intended
Diffstat (limited to 'src/cadet/cadet_api.c')
-rw-r--r--src/cadet/cadet_api.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 91054cd4f..b019424f9 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -898,7 +898,6 @@ check_get_peer (void *cls,
898 const struct GNUNET_PeerIdentity *paths_array; 898 const struct GNUNET_PeerIdentity *paths_array;
899 size_t esize; 899 size_t esize;
900 unsigned int epaths; 900 unsigned int epaths;
901 unsigned int paths;
902 unsigned int peers; 901 unsigned int peers;
903 902
904 esize = ntohs (message->header.size); 903 esize = ntohs (message->header.size);
@@ -915,17 +914,7 @@ check_get_peer (void *cls,
915 peers = (esize - msize) / sizeof (struct GNUNET_PeerIdentity); 914 peers = (esize - msize) / sizeof (struct GNUNET_PeerIdentity);
916 epaths = ntohs (message->paths); 915 epaths = ntohs (message->paths);
917 paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; 916 paths_array = (const struct GNUNET_PeerIdentity *) &message[1];
918 paths = 0; 917
919 for (unsigned int i = 0; i < peers; i++)
920 if (0 == memcmp (&paths_array[i],
921 &message->destination,
922 sizeof (struct GNUNET_PeerIdentity)))
923 paths++;
924 if (paths != epaths)
925 {
926 GNUNET_break (0);
927 return GNUNET_SYSERR;
928 }
929 return GNUNET_OK; 918 return GNUNET_OK;
930} 919}
931 920
@@ -949,6 +938,11 @@ handle_get_peer (void *cls,
949 938
950 if (NULL == h->info_cb.peer_cb) 939 if (NULL == h->info_cb.peer_cb)
951 return; 940 return;
941
942 LOG (GNUNET_ERROR_TYPE_DEBUG,
943 "number of paths %u\n",
944 ntohs (message->paths));
945
952 paths = ntohs (message->paths); 946 paths = ntohs (message->paths);
953 paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; 947 paths_array = (const struct GNUNET_PeerIdentity *) &message[1];
954 peers = (ntohs (message->header.size) - sizeof (*message)) 948 peers = (ntohs (message->header.size) - sizeof (*message))
@@ -978,7 +972,9 @@ handle_get_peer (void *cls,
978 (int) ntohs (message->tunnel), 972 (int) ntohs (message->tunnel),
979 neighbor, 973 neighbor,
980 paths, 974 paths,
981 paths_array); 975 paths_array,
976 (int) ntohs (message->offset),
977 (int) ntohs (message->finished_with_paths));
982} 978}
983 979
984 980