{
if (OP_STATE_INIT == op->state)
{
- entry = GNUNET_malloc (sizeof (struct QueueEntry));
+ entry = GNUNET_new (struct QueueEntry);
entry->op = op;
entry->nres = op->nres[cnt];
s = cnt;
struct ReadyQueueEntry *rq_entry;
GNUNET_assert (NULL == op->rq_entry);
- rq_entry = GNUNET_malloc (sizeof (struct ReadyQueueEntry));
+ rq_entry = GNUNET_new (struct ReadyQueueEntry);
rq_entry->op = op;
GNUNET_CONTAINER_DLL_insert_tail (rq_head, rq_tail, rq_entry);
op->rq_entry = rq_entry;
adaptive_queue_set_max_active (queue, queue->max_active); /* no change */
return;
}
+ if (1 == sd)
+ adaptive_queue_set_max_active (queue, queue->max_active - 1);
+ if (2 <= sd)
+ adaptive_queue_set_max_active (queue, queue->max_active / 2);
+ if (-1 == sd)
+ adaptive_queue_set_max_active (queue, queue->max_active + 1);
+ if (sd <= -2)
+ adaptive_queue_set_max_active (queue, queue->max_active * 2);
+
+#if 0 /* old algorithm */
if (sd < 0)
sd = 0;
GNUNET_assert (0 <= sd);
return;
}
adaptive_queue_set_max_active (queue, queue->max_active / 2);
+#endif
}
{
struct GNUNET_TESTBED_Operation *op;
- op = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Operation));
+ op = GNUNET_new (struct GNUNET_TESTBED_Operation);
op->start = start;
op->state = OP_STATE_INIT;
op->release = release;
struct OperationQueue *queue;
struct FeedbackCtx *fctx;
- queue = GNUNET_malloc (sizeof (struct OperationQueue));
+ queue = GNUNET_new (struct OperationQueue);
queue->type = type;
if (OPERATION_QUEUE_TYPE_FIXED == type)
{
}
else
{
- fctx = GNUNET_malloc (sizeof (struct FeedbackCtx));
+ fctx = GNUNET_new (struct FeedbackCtx);
fctx->max_active_bound = max_active;
fctx->sd = GNUNET_TESTBED_SD_init_ (10); /* FIXME: Why 10? */
queue->fctx = fctx;