if (NULL == buf)
{
/* failed, try again... */
+ if (GNUNET_SCHEDULER_NO_TASK != pp->task)
+ GNUNET_SCHEDULER_cancel (pp->task);
+
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
GNUNET_STATISTICS_update (GSF_stats,
gettext_noop
rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap);
if (NULL == rp)
{
+ if (GNUNET_SCHEDULER_NO_TASK != pp->task)
+ GNUNET_SCHEDULER_cancel (pp->task);
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)
{
+ if (GNUNET_SCHEDULER_NO_TASK != pp->task)
+ GNUNET_SCHEDULER_cancel (pp->task);
/* buffer to small (message changed), try again */
pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
return 0;
GSF_pending_request_is_compatible_ (mpr->pr, rp->pe_head->pr))
return GNUNET_YES;
/* merge new request with existing request plan */
- bi = GNUNET_malloc (sizeof (struct GSF_PendingRequestPlanBijection));
+ bi = GNUNET_new (struct GSF_PendingRequestPlanBijection);
bi->rp = rp;
bi->pr = mpr->pr;
prd = GSF_pending_request_get_data_ (mpr->pr);
pp = GNUNET_CONTAINER_multihashmap_get (plans, &id->hashPubKey);
if (NULL == pp)
{
- pp = GNUNET_malloc (sizeof (struct PeerPlan));
+ pp = GNUNET_new (struct PeerPlan);
pp->plan_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
pp->priority_heap =
GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MAX);
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); // 8 MB
+ bi = GNUNET_new (struct GSF_PendingRequestPlanBijection);
bi->rp = rp;
bi->pr = pr;
GNUNET_CONTAINER_MDLL_insert (PR, prd->pr_head, prd->pr_tail, bi);
*
* @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.
+ * @param result the timestamp to fill, set to "FOREVER" if never transmitted
* @return GNUNET_YES if 'result' was changed, GNUNET_NO otherwise.
*/
int
{
if (bi->rp->pp->cp == sender)
{
- *result = bi->rp->last_transmission;
+ if (0 == bi->rp->last_transmission.abs_value)
+ *result = GNUNET_TIME_UNIT_FOREVER_ABS;
+ else
+ *result = bi->rp->last_transmission;
return GNUNET_YES;
}
}