aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_pr.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-03-09 19:07:13 +0000
committerChristian Grothoff <christian@grothoff.org>2011-03-09 19:07:13 +0000
commit073c4a9ae448041fdc9a0683fed49d55ae61803e (patch)
tree9bf2bacde4723ea25f70a0cdb324a1d76be763de /src/fs/gnunet-service-fs_pr.c
parentfafacaa77732d1dadcfcb10e4901dda76840a76d (diff)
downloadgnunet-073c4a9ae448041fdc9a0683fed49d55ae61803e.tar.gz
gnunet-073c4a9ae448041fdc9a0683fed49d55ae61803e.zip
hxing
Diffstat (limited to 'src/fs/gnunet-service-fs_pr.c')
-rw-r--r--src/fs/gnunet-service-fs_pr.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 3c291cfc9..45767f204 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -65,6 +65,12 @@ struct GSF_PendingRequest
65 struct GNUNET_CONTAINER_HeapNode *hnode; 65 struct GNUNET_CONTAINER_HeapNode *hnode;
66 66
67 /** 67 /**
68 * Identity of the peer that we should use for the 'sender'
69 * (recipient of the response) when forwarding (0 for none).
70 */
71 GNUNET_PEER_Id sender_pid;
72
73 /**
68 * Number of valid entries in the 'replies_seen' array. 74 * Number of valid entries in the 'replies_seen' array.
69 */ 75 */
70 unsigned int replies_seen_count; 76 unsigned int replies_seen_count;
@@ -203,6 +209,7 @@ refresh_bloomfilter (struct GSF_PendingRequest *pr)
203 * @param anonymity_level desired anonymity level 209 * @param anonymity_level desired anonymity level
204 * @param priority maximum outgoing cummulative request priority to use 210 * @param priority maximum outgoing cummulative request priority to use
205 * @param ttl current time-to-live for the request 211 * @param ttl current time-to-live for the request
212 * @param sender_pid peer ID to use for the sender when forwarding, 0 for none
206 * @param replies_seen hash codes of known local replies 213 * @param replies_seen hash codes of known local replies
207 * @param replies_seen_count size of the 'replies_seen' array 214 * @param replies_seen_count size of the 'replies_seen' array
208 * @param rh handle to call when we get a reply 215 * @param rh handle to call when we get a reply
@@ -221,6 +228,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
221 uint32_t anonymity_level, 228 uint32_t anonymity_level,
222 uint32_t priority, 229 uint32_t priority,
223 int32_t ttl, 230 int32_t ttl,
231 GNUNET_PEER_Id sender_pid,
224 const GNUNET_HashCode *replies_seen, 232 const GNUNET_HashCode *replies_seen,
225 unsigned int replies_seen_count, 233 unsigned int replies_seen_count,
226 GSF_PendingRequestReplyHandler rh, 234 GSF_PendingRequestReplyHandler rh,
@@ -247,6 +255,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
247 pr->public_data.options = options; 255 pr->public_data.options = options;
248 pr->public_data.type = type; 256 pr->public_data.type = type;
249 pr->public_data.start_time = GNUNET_TIME_absolute_get (); 257 pr->public_data.start_time = GNUNET_TIME_absolute_get ();
258 pr->sender_pid = sender_pid;
250 pr->rh = rh; 259 pr->rh = rh;
251 pr->rh_cls = rh_cls; 260 pr->rh_cls = rh_cls;
252 if (ttl >= 0) 261 if (ttl >= 0)
@@ -451,14 +460,14 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr,
451 ext = (GNUNET_HashCode*) &gm[1]; 460 ext = (GNUNET_HashCode*) &gm[1];
452 k = 0; 461 k = 0;
453 if (GNUNET_YES != do_route) 462 if (GNUNET_YES != do_route)
454 GNUNET_PEER_resolve (pr->cp->pid, 463 GNUNET_PEER_resolve (pr->sender_pid,
455 (struct GNUNET_PeerIdentity*) &ext[k++]); 464 (struct GNUNET_PeerIdentity*) &ext[k++]);
456 if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type) 465 if (GNUNET_BLOCK_TYPE_FS_SBLOCK == pr->public_data.type)
457 memcpy (&ext[k++], 466 memcpy (&ext[k++],
458 &pr->public_data.namespace, 467 &pr->public_data.namespace,
459 sizeof (GNUNET_HashCode)); 468 sizeof (GNUNET_HashCode));
460 if (GNUNET_YES == pr->public_data.has_target) 469 if (GNUNET_YES == pr->public_data.has_target)
461 GNUNET_PEER_resolve (pr->public_data.target_pid, 470 GNUNET_PEER_resolve (pr->sender_pid,
462 (struct GNUNET_PeerIdentity*) &ext[k++]); 471 (struct GNUNET_PeerIdentity*) &ext[k++]);
463 if (pr->bf != NULL) 472 if (pr->bf != NULL)
464 GNUNET_CONTAINER_bloomfilter_get_raw_data (pr->bf, 473 GNUNET_CONTAINER_bloomfilter_get_raw_data (pr->bf,
@@ -487,6 +496,7 @@ clean_request (void *cls,
487 GNUNET_free_non_null (pr->replies_seen); 496 GNUNET_free_non_null (pr->replies_seen);
488 if (NULL != pr->bf) 497 if (NULL != pr->bf)
489 GNUNET_CONTAINER_bloomfilter_free (pr->bf); 498 GNUNET_CONTAINER_bloomfilter_free (pr->bf);
499 GNUNET_PEER_change_rc (pr->sender_pid, -1);
490 if (NULL != pr->hnode) 500 if (NULL != pr->hnode)
491 GNUNET_CONTAINER_heap_remove_node (requests_by_expiration_heap, 501 GNUNET_CONTAINER_heap_remove_node (requests_by_expiration_heap,
492 pr->hnode); 502 pr->hnode);
@@ -519,8 +529,8 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr)
519 * @param cls closure for it 529 * @param cls closure for it
520 */ 530 */
521void 531void
522GSF_iterate_pending_pr_map_ (GSF_PendingRequestIterator it, 532GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it,
523 void *cls) 533 void *cls)
524{ 534{
525 GNUNET_CONTAINER_multihashmap_iterate (pr_map, 535 GNUNET_CONTAINER_multihashmap_iterate (pr_map,
526 (GNUNET_CONTAINER_HashMapIterator) it, 536 (GNUNET_CONTAINER_HashMapIterator) it,
@@ -943,14 +953,12 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
943 953
944/** 954/**
945 * Setup the subsystem. 955 * Setup the subsystem.
946 *
947 * @param cfg configuration to use
948 */ 956 */
949void 957void
950GSF_pending_request_init_ (struct GNUNET_CONFIGURATION_Handle *cfg) 958GSF_pending_request_init_ ()
951{ 959{
952 if (GNUNET_OK != 960 if (GNUNET_OK !=
953 GNUNET_CONFIGURATION_get_value_number (cfg, 961 GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
954 "fs", 962 "fs",
955 "MAX_PENDING_REQUESTS", 963 "MAX_PENDING_REQUESTS",
956 &max_pending_requests)) 964 &max_pending_requests))