diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index 9cd1f5229..8e536e376 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -1235,6 +1235,41 @@ GCP_iterate_paths (struct CadetPeer *cp, | |||
1235 | return ret; | 1235 | return ret; |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | /** | ||
1239 | * Iterate over the paths to a peer without direct link. | ||
1240 | * | ||
1241 | * @param cp Peer to get path info. | ||
1242 | * @param callback Function to call for every path. | ||
1243 | * @param callback_cls Closure for @a callback. | ||
1244 | * @return Number of iterated paths. | ||
1245 | */ | ||
1246 | unsigned int | ||
1247 | GCP_iterate_indirect_paths (struct CadetPeer *cp, | ||
1248 | GCP_PathIterator callback, | ||
1249 | void *callback_cls) | ||
1250 | { | ||
1251 | unsigned int ret = 0; | ||
1252 | |||
1253 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1254 | "Iterating over paths to peer %s without direct link\n", | ||
1255 | GCP_2s (cp)); | ||
1256 | for (unsigned int i=1;i<cp->path_dll_length;i++) | ||
1257 | { | ||
1258 | for (struct CadetPeerPathEntry *pe = cp->path_heads[i]; | ||
1259 | NULL != pe; | ||
1260 | pe = pe->next) | ||
1261 | { | ||
1262 | ret++; | ||
1263 | if (GNUNET_NO == | ||
1264 | callback (callback_cls, | ||
1265 | pe->path, | ||
1266 | i)) | ||
1267 | return ret; | ||
1268 | } | ||
1269 | } | ||
1270 | return ret; | ||
1271 | } | ||
1272 | |||
1238 | 1273 | ||
1239 | /** | 1274 | /** |
1240 | * Iterate over the paths to @a cp where | 1275 | * Iterate over the paths to @a cp where |