{
struct GSF_PendingRequest *pr = cls;
+ if (GNUNET_YES !=
+ GSF_pending_request_test_target_ (pr,
+ peer))
+ {
+ GNUNET_STATISTICS_update (GSF_stats,
+ gettext_noop ("# Loopback routes suppressed"), 1,
+ GNUNET_NO);
+ return;
+ }
GSF_plan_add_ (cp, pr);
}
if (GNUNET_YES !=
GSF_pending_request_test_target_ (pr,
&pid))
+ {
+ GNUNET_STATISTICS_update (GSF_stats,
+ gettext_noop ("# Loopback routes suppressed"), 1,
+ GNUNET_NO);
return GNUNET_YES;
+ }
GSF_plan_add_ (cp, pr);
return GNUNET_YES;
}
0) ? (const char *) &opt[bits] : NULL,
bfsize, ntohl (gm->filter_mutator),
1 /* anonymity */ ,
- (uint32_t) priority, ttl, spid, NULL, 0, /* replies_seen */
+ (uint32_t) priority, ttl, spid,
+ GNUNET_PEER_intern (other),
+ NULL, 0, /* replies_seen */
&handle_p2p_reply, peerreq);
GNUNET_assert (NULL != pr);
peerreq->pr = pr;
ntohl (sm->anonymity_level),
0 /* priority */ ,
0 /* ttl */ ,
- 0 /* sender PID */ ,
+ 0 /* sender PID */ , 0 /* origin PID */,
(const GNUNET_HashCode *) &sm[1], sc,
&client_response_handler, cr);
return cr->pr;
total_delay * 1000LL / plan_count, GNUNET_NO);
prd = GSF_pending_request_get_data_ (rp->prl_head->pr);
// FIXME: calculate 'rp->priority'!
+#if 0
if (rp->transmission_counter < 32)
delay =
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
1LL << rp->transmission_counter);
else
delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX);
+#else
+ if (rp->transmission_counter < 32)
+ delay =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
+ rp->transmission_counter);
+ else if (rp->transmission_counter < 32)
+ delay =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
+ 32 + (1LL << rp->transmission_counter));
+ else
+ delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, UINT_MAX);
+#endif
rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay);
#if DEBUG_FS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GSF_peer_transmit_cancel_ (pp->pth);
pp->pth = NULL;
}
- GNUNET_STATISTICS_set (GSF_stats,
- gettext_noop ("# query delay heap size"),
- GNUNET_CONTAINER_heap_get_size (pp->delay_heap),
- GNUNET_NO);
- GNUNET_STATISTICS_set (GSF_stats,
- gettext_noop ("# query priority heap size"),
- GNUNET_CONTAINER_heap_get_size (pp->priority_heap),
- GNUNET_NO);
/* move ready requests to priority queue */
while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
(GNUNET_TIME_absolute_get_remaining
*/
GNUNET_PEER_Id sender_pid;
+ /**
+ * Identity of the peer that we should never forward this query
+ * to since it originated this query (0 for none).
+ */
+ GNUNET_PEER_Id origin_pid;
+
/**
* Time we started the last datastore lookup.
*/
* @param priority maximum outgoing cummulative request priority to use
* @param ttl current time-to-live for the request
* @param sender_pid peer ID to use for the sender when forwarding, 0 for none
+ * @param origin_pid peer ID of origin of query (do not loop back)
* @param replies_seen hash codes of known local replies
* @param replies_seen_count size of the 'replies_seen' array
* @param rh handle to call when we get a reply
uint32_t mingle, uint32_t anonymity_level,
uint32_t priority, int32_t ttl,
GNUNET_PEER_Id sender_pid,
+ GNUNET_PEER_Id origin_pid,
const GNUNET_HashCode * replies_seen,
unsigned int replies_seen_count,
GSF_PendingRequestReplyHandler rh, void *rh_cls)
pr->public_data.type = type;
pr->public_data.start_time = GNUNET_TIME_absolute_get ();
pr->sender_pid = sender_pid;
+ pr->origin_pid = origin_pid;
pr->rh = rh;
pr->rh_cls = rh_cls;
GNUNET_assert ((sender_pid != 0) || (0 == (options & GSF_PRO_FORWARD_ONLY)));
}
GNUNET_PEER_change_rc (pr->sender_pid, -1);
pr->sender_pid = 0;
+ GNUNET_PEER_change_rc (pr->origin_pid, -1);
+ pr->origin_pid = 0;
if (NULL != pr->hnode)
{
GNUNET_CONTAINER_heap_remove_node (pr->hnode);
/* queue priority */ ,
(0 !=
(GSF_PRO_PRIORITY_UNLIMITED &
- pr->public_data.options)) ? UINT_MAX : 1
+ pr->public_data.options)) ? UINT_MAX : 16
/* max queue size */ ,
GNUNET_TIME_UNIT_FOREVER_REL,
&process_local_reply, pr);
/* queue priority */ ,
(0 !=
(GSF_PRO_PRIORITY_UNLIMITED &
- pr->public_data.options)) ? UINT_MAX : 1
+ pr->public_data.options)) ? UINT_MAX : 16
/* max queue size */ ,
GNUNET_TIME_UNIT_FOREVER_REL,
&process_local_reply, pr);
{
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
- ("# Datastore lookups concluded (found ultimate result)"),
+ ("# Datastore lookups concluded (found last result)"),
1, GNUNET_NO);
goto check_error_and_continue;
}
/* queue priority */ ,
(0 !=
(GSF_PRO_PRIORITY_UNLIMITED & pr->
- public_data.options)) ? UINT_MAX : 1
+ public_data.options)) ? UINT_MAX : 16
/* max queue size */ ,
GNUNET_TIME_UNIT_FOREVER_REL,
&process_local_reply, pr);
{
struct GNUNET_PeerIdentity pi;
- if (0 == pr->sender_pid)
+ if (0 == pr->origin_pid)
return GNUNET_YES;
- GNUNET_PEER_resolve (pr->sender_pid, &pi);
+ GNUNET_PEER_resolve (pr->origin_pid, &pi);
return (0 == memcmp (&pi, target, sizeof (struct GNUNET_PeerIdentity))) ? GNUNET_NO :GNUNET_YES;
}
/* queue priority */ ,
(0 !=
(GSF_PRO_PRIORITY_UNLIMITED & pr->
- public_data.options)) ? UINT_MAX : 1
+ public_data.options)) ? UINT_MAX : 16
/* max queue size */ ,
GNUNET_TIME_UNIT_FOREVER_REL,
&process_local_reply, pr);
* @param ttl current time-to-live for the request
* @param sender_pid peer ID to use for the sender when forwarding, 0 for none;
* reference counter is taken over by this function
+ * @param origin_pid peer ID of origin of query (do not loop back)
* @param replies_seen hash codes of known local replies
* @param replies_seen_count size of the 'replies_seen' array
* @param rh handle to call when we get a reply
uint32_t mingle, uint32_t anonymity_level,
uint32_t priority, int32_t ttl,
GNUNET_PEER_Id sender_pid,
+ GNUNET_PEER_Id origin_pid,
const GNUNET_HashCode * replies_seen,
unsigned int replies_seen_count,
GSF_PendingRequestReplyHandler rh, void *rh_cls);