diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-19 13:31:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-19 13:31:20 +0000 |
commit | cea1f6d7409c705a6b9a26308bae7b5674e0bd6a (patch) | |
tree | 7f3b1f825dce99d04cd2a50aeecd43e5dde6773f /src/fs | |
parent | f38992e2e7f5a4b8ff33b44c9f5ba69f54987369 (diff) | |
download | gnunet-cea1f6d7409c705a6b9a26308bae7b5674e0bd6a.tar.gz gnunet-cea1f6d7409c705a6b9a26308bae7b5674e0bd6a.zip |
do not loop back
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 6 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 2 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 20 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.h | 13 |
4 files changed, 40 insertions, 1 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 866860c0a..bf6984dd6 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -424,7 +424,13 @@ consider_peer_for_forwarding (void *cls, const GNUNET_HashCode * key, | |||
424 | struct GSF_PendingRequest *pr) | 424 | struct GSF_PendingRequest *pr) |
425 | { | 425 | { |
426 | struct GSF_ConnectedPeer *cp = cls; | 426 | struct GSF_ConnectedPeer *cp = cls; |
427 | struct GNUNET_PeerIdentity pid; | ||
427 | 428 | ||
429 | GSF_connected_peer_get_identity_ (cp, &pid); | ||
430 | if (GNUNET_YES != | ||
431 | GSF_pending_request_test_target_ (pr, | ||
432 | &pid)) | ||
433 | return GNUNET_YES; | ||
428 | GSF_plan_add_ (cp, pr); | 434 | GSF_plan_add_ (cp, pr); |
429 | return GNUNET_YES; | 435 | return GNUNET_YES; |
430 | } | 436 | } |
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 10c522299..dc83c9960 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -334,7 +334,7 @@ transmit_message_callback (void *cls, size_t buf_size, void *buf) | |||
334 | plan (pp, rp); | 334 | plan (pp, rp); |
335 | GNUNET_STATISTICS_update (GSF_stats, | 335 | GNUNET_STATISTICS_update (GSF_stats, |
336 | gettext_noop | 336 | gettext_noop |
337 | ("# queries messages sent to other peers"), 1, | 337 | ("# query messages sent to other peers"), 1, |
338 | GNUNET_NO); | 338 | GNUNET_NO); |
339 | return msize; | 339 | return msize; |
340 | } | 340 | } |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 052fd86ea..953983d37 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -1337,6 +1337,26 @@ check_error_and_continue: | |||
1337 | 1337 | ||
1338 | 1338 | ||
1339 | /** | 1339 | /** |
1340 | * Is the given target a legitimate peer for forwarding the given request? | ||
1341 | * | ||
1342 | * @param pr request | ||
1343 | * @param target | ||
1344 | * @return GNUNET_YES if this request could be forwarded to the given peer | ||
1345 | */ | ||
1346 | int | ||
1347 | GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, | ||
1348 | const struct GNUNET_PeerIdentity *target) | ||
1349 | { | ||
1350 | struct GNUNET_PeerIdentity pi; | ||
1351 | |||
1352 | if (0 == pr->sender_pid) | ||
1353 | return GNUNET_YES; | ||
1354 | GNUNET_PEER_resolve (pr->sender_pid, &pi); | ||
1355 | return (0 == memcmp (&pi, target, sizeof (struct GNUNET_PeerIdentity))) ? GNUNET_NO :GNUNET_YES; | ||
1356 | } | ||
1357 | |||
1358 | |||
1359 | /** | ||
1340 | * Look up the request in the local datastore. | 1360 | * Look up the request in the local datastore. |
1341 | * | 1361 | * |
1342 | * @param pr the pending request to process | 1362 | * @param pr the pending request to process |
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index c8ea5b47f..c8b52398e 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h | |||
@@ -356,6 +356,19 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, | |||
356 | 356 | ||
357 | 357 | ||
358 | /** | 358 | /** |
359 | * Is the given target a legitimate peer for forwarding the given request? | ||
360 | * | ||
361 | * @param pr request | ||
362 | * @param target | ||
363 | * @return GNUNET_YES if this request could be forwarded to the given peer | ||
364 | */ | ||
365 | int | ||
366 | GSF_pending_request_test_target_ (struct GSF_PendingRequest *pr, | ||
367 | const struct GNUNET_PeerIdentity *target); | ||
368 | |||
369 | |||
370 | |||
371 | /** | ||
359 | * Setup the subsystem. | 372 | * Setup the subsystem. |
360 | */ | 373 | */ |
361 | void | 374 | void |