GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
* Similarly head and tail of the "PR" MDLL are stored
* with the 'struct GSF_PendingRequest'. (We need
* to be able to lookup all plan entries corresponding
* Similarly head and tail of the "PR" MDLL are stored
* with the 'struct GSF_PendingRequest'. (We need
* to be able to lookup all plan entries corresponding
rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Earliest (re)transmission for `%s' in %us\n",
GNUNET_h2s (&prd->query), rp->transmission_counter);
GNUNET_assert (rp->hn == NULL);
rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Earliest (re)transmission for `%s' in %us\n",
GNUNET_h2s (&prd->query), rp->transmission_counter);
GNUNET_assert (rp->hn == NULL);
rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority);
else
rp->hn =
GNUNET_CONTAINER_heap_insert (pp->delay_heap, rp,
rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority);
else
rp->hn =
GNUNET_CONTAINER_heap_insert (pp->delay_heap, rp,
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains_value (pp->plan_map,
get_rp_key (rp),
rp));
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains_value (pp->plan_map,
get_rp_key (rp),
rp));
GNUNET_SCHEDULER_cancel (pp->task);
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
#undef N
GNUNET_SCHEDULER_cancel (pp->task);
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
#undef N
- if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value >
- GSF_pending_request_get_data_ (ret)->ttl.abs_value)
+ if (GSF_pending_request_get_data_ (bi->pr)->ttl.abs_value_us >
+ GSF_pending_request_get_data_ (ret)->ttl.abs_value_us)
* @param buf where to copy the message, NULL on error (peer disconnect)
* @return number of bytes copied to 'buf', can be 0 (without indicating an error)
*/
* @param buf where to copy the message, NULL on error (peer disconnect)
* @return number of bytes copied to 'buf', can be 0 (without indicating an error)
*/
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
return 0;
}
msize = GSF_pending_request_get_message_ (get_latest (rp), buf_size, buf);
if (msize > buf_size)
{
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
return 0;
}
msize = GSF_pending_request_get_message_ (get_latest (rp), buf_size, buf);
if (msize > buf_size)
{
/* buffer to small (message changed), try again */
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
return 0;
/* buffer to small (message changed), try again */
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
return 0;
}
/* move ready requests to priority queue */
while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
}
/* move ready requests to priority queue */
while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
{
GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap));
rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority);
{
GNUNET_assert (rp == GNUNET_CONTAINER_heap_remove_root (pp->delay_heap));
rp->hn = GNUNET_CONTAINER_heap_insert (pp->priority_heap, rp, rp->priority);
}
delay = GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
}
delay = GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sleeping for %llu ms before retrying requests on plan %p.\n",
- (unsigned long long) delay.rel_value, pp);
- GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# delay heap timeout"),
- delay.rel_value, GNUNET_NO);
+ "Sleeping for %s before retrying requests on plan %p.\n",
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES),
+ pp);
+ GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# delay heap timeout (ms)"),
+ delay.rel_value_us / 1000LL, GNUNET_NO);
- * @return GNUNET_YES if we should continue to iterate,
- * GNUNET_NO if not (merge success)
+ * @return #GNUNET_YES if we should continue to iterate,
+ * #GNUNET_NO if not (merge success)
GSF_pending_request_is_compatible_ (mpr->pr, rp->pe_head->pr))
return GNUNET_YES;
/* merge new request with existing request plan */
GSF_pending_request_is_compatible_ (mpr->pr, rp->pe_head->pr))
return GNUNET_YES;
/* merge new request with existing request plan */
pp->plan_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
pp->priority_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
pp->delay_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
pp->cp = cp;
pp->plan_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
pp->priority_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
pp->delay_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
pp->cp = cp;
- GNUNET_CONTAINER_multihashmap_put (plans,
- &id->hashPubKey, pp,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multipeermap_put (plans,
+ id, pp,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
}
mpc.merged = GNUNET_NO;
mpc.pr = pr;
GNUNET_CONTAINER_multihashmap_get_multiple (pp->plan_map,
&GSF_pending_request_get_data_
}
mpc.merged = GNUNET_NO;
mpc.pr = pr;
GNUNET_CONTAINER_multihashmap_get_multiple (pp->plan_map,
&GSF_pending_request_get_data_
if (GNUNET_NO != mpc.merged)
return;
GNUNET_CONTAINER_multihashmap_get_multiple (pp->plan_map,
if (GNUNET_NO != mpc.merged)
return;
GNUNET_CONTAINER_multihashmap_get_multiple (pp->plan_map,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Planning transmission of query `%s' to peer `%s'\n",
GNUNET_h2s (&prd->query), GNUNET_i2s (id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Planning transmission of query `%s' to peer `%s'\n",
GNUNET_h2s (&prd->query), GNUNET_i2s (id));
- rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan)); // 8 MB
- bi = GNUNET_malloc (sizeof (struct GSF_PendingRequestPlanBijection));
+ rp = GNUNET_new (struct GSF_RequestPlan);
+ bi = GNUNET_new (struct GSF_PendingRequestPlanBijection);
bi->rp = rp;
bi->pr = pr;
GNUNET_CONTAINER_MDLL_insert (PR, prd->pr_head, prd->pr_tail, bi);
bi->rp = rp;
bi->pr = pr;
GNUNET_CONTAINER_MDLL_insert (PR, prd->pr_head, prd->pr_tail, bi);
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (pp->plan_map,
get_rp_key (rp), rp,
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (pp->plan_map,
get_rp_key (rp), rp,
GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi);
GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi);
GNUNET_free (bi);
GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi);
GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi);
GNUNET_free (bi);
*
* @param pr_head request plan reference list to check.
* @param sender the peer that we've sent the request to.
*
* @param pr_head request plan reference list to check.
* @param sender the peer that we've sent the request to.
- * @param result the timestamp to fill.
- * @return GNUNET_YES if 'result' was changed, GNUNET_NO otherwise.
+ * @param result the timestamp to fill, set to #GNUNET_TIME_UNIT_FOREVER_ABS if never transmitted
+ * @return #GNUNET_YES if @a result was changed, #GNUNET_NO otherwise.
-GSF_request_plan_reference_get_last_transmission_ (
- struct GSF_PendingRequestPlanBijection *pr_head, struct GSF_ConnectedPeer *sender,
- struct GNUNET_TIME_Absolute *result)
+GSF_request_plan_reference_get_last_transmission_ (struct GSF_PendingRequestPlanBijection *pr_head,
+ struct GSF_ConnectedPeer *sender,
+ struct GNUNET_TIME_Absolute *result)
GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi);
GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi);
GNUNET_CONTAINER_MDLL_remove (PR, prd->pr_head, prd->pr_tail, bi);
GNUNET_CONTAINER_MDLL_remove (PE, rp->pe_head, rp->pe_tail, bi);
- GNUNET_assert (0 == GNUNET_CONTAINER_multihashmap_size (plans));
- GNUNET_CONTAINER_multihashmap_destroy (plans);
+ GNUNET_assert (0 == GNUNET_CONTAINER_multipeermap_size (plans));
+ GNUNET_CONTAINER_multipeermap_destroy (plans);