[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26907 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26907 - gnunet/src/testbed |
Date: |
Tue, 16 Apr 2013 18:17:08 +0200 |
Author: harsha
Date: 2013-04-16 18:17:08 +0200 (Tue, 16 Apr 2013)
New Revision: 26907
Modified:
gnunet/src/testbed/testbed_api_operations.c
Log:
- stop iterating through waiting operations earlier
Modified: gnunet/src/testbed/testbed_api_operations.c
===================================================================
--- gnunet/src/testbed/testbed_api_operations.c 2013-04-16 14:53:12 UTC (rev
26906)
+++ gnunet/src/testbed/testbed_api_operations.c 2013-04-16 16:17:08 UTC (rev
26907)
@@ -547,8 +547,11 @@
* Checks for the readiness of an operation and schedules a operation start
task
*
* @param op the operation
+ * @param GNUNET_NO if the given operation cannot be made active; GNUNET_YES if
+ * it can be activated (has enough resources) and is kept in ready
+ * queue
*/
-static void
+static int
check_readiness (struct GNUNET_TESTBED_Operation *op)
{
struct GNUNET_TESTBED_Operation **evict_ops;
@@ -569,7 +572,7 @@
&ops, &n_ops))
{
GNUNET_free_non_null (evict_ops);
- return;
+ return GNUNET_NO;
}
if (NULL == ops)
continue;
@@ -584,12 +587,13 @@
evict_ops = NULL;
/* Evicting the operations should schedule this operation */
GNUNET_assert (OP_STATE_READY == op->state);
- return;
+ return GNUNET_YES;
}
for (i = 0; i < op->nqueues; i++)
op->queues[i]->active += op->nres[i];
change_state (op, OP_STATE_READY);
rq_add (op);
+ return GNUNET_YES;
}
@@ -699,7 +703,8 @@
while (NULL != entry)
{
entry2 = entry->next;
- check_readiness (entry->op);
+ if (GNUNET_NO == check_readiness (entry->op))
+ break;
entry = entry2;
}
}
@@ -786,7 +791,7 @@
{
GNUNET_assert (NULL == op->rq_entry);
change_state (op, OP_STATE_WAITING);
- check_readiness (op);
+ (void) check_readiness (op);
}
@@ -812,6 +817,8 @@
nqueues = op->nqueues;
ms = sizeof (struct OperationQueue *) * nqueues;
queues = GNUNET_malloc (ms);
+ /* Cloning is needed as the operation be released by waiting operations and
+ hence its nqueues memory ptr will be freed */
GNUNET_assert (NULL != (queues = memcpy (queues, op->queues, ms)));
for (i = 0; i < nqueues; i++)
recheck_waiting (queues[i]);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26907 - gnunet/src/testbed,
gnunet <=