diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-01-01 22:44:12 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-01-01 22:44:12 +0000 |
commit | 01e21ba6afe2d16ba45b5a73f2777152fd27ffc3 (patch) | |
tree | e4ba10669fac95d66763c8d9c8812eda9da3b7b0 /src/testbed/testbed_api_peers.c | |
parent | 5200c6d68ff70c484c480794e5debbc50b62e2aa (diff) | |
download | gnunet-01e21ba6afe2d16ba45b5a73f2777152fd27ffc3.tar.gz gnunet-01e21ba6afe2d16ba45b5a73f2777152fd27ffc3.zip |
adaptive parallelism for overlay connect operations based on SD calculations
Diffstat (limited to 'src/testbed/testbed_api_peers.c')
-rw-r--r-- | src/testbed/testbed_api_peers.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c index cee50bbff..d558ef06d 100644 --- a/src/testbed/testbed_api_peers.c +++ b/src/testbed/testbed_api_peers.c | |||
@@ -340,6 +340,8 @@ opstart_overlay_connect (void *cls) | |||
340 | opc->state = OPC_STATE_STARTED; | 340 | opc->state = OPC_STATE_STARTED; |
341 | data = opc->data; | 341 | data = opc->data; |
342 | GNUNET_assert (NULL != data); | 342 | GNUNET_assert (NULL != data); |
343 | data->tslot_index = GNUNET_TESTBED_get_tslot_ (opc->c, data); | ||
344 | data->tstart = GNUNET_TIME_absolute_get (); | ||
343 | msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)); | 345 | msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)); |
344 | msg->header.size = | 346 | msg->header.size = |
345 | htons (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)); | 347 | htons (sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)); |
@@ -362,12 +364,24 @@ static void | |||
362 | oprelease_overlay_connect (void *cls) | 364 | oprelease_overlay_connect (void *cls) |
363 | { | 365 | { |
364 | struct OperationContext *opc = cls; | 366 | struct OperationContext *opc = cls; |
367 | struct GNUNET_TIME_Relative duration; | ||
368 | struct OverlayConnectData *data; | ||
365 | 369 | ||
366 | if (OPC_STATE_STARTED == opc->state) | 370 | data = opc->data; |
371 | switch (opc->state) | ||
367 | { | 372 | { |
368 | GNUNET_free (opc->data); | 373 | case OPC_STATE_INIT: |
374 | break; | ||
375 | case OPC_STATE_STARTED: | ||
376 | (void) GNUNET_TESTBED_release_time_slot_ (opc->c, data->tslot_index, data); | ||
369 | GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); | 377 | GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); |
378 | break; | ||
379 | case OPC_STATE_FINISHED: | ||
380 | duration = GNUNET_TIME_absolute_get_duration (data->tstart); | ||
381 | GNUNET_TESTBED_update_time_slot_ (opc->c, data->tslot_index, | ||
382 | data, duration); | ||
370 | } | 383 | } |
384 | GNUNET_free (data); | ||
371 | GNUNET_free (opc); | 385 | GNUNET_free (opc); |
372 | } | 386 | } |
373 | 387 | ||
@@ -675,7 +689,6 @@ GNUNET_TESTBED_overlay_connect (void *op_cls, | |||
675 | data->p2 = p2; | 689 | data->p2 = p2; |
676 | data->cb = cb; | 690 | data->cb = cb; |
677 | data->cb_cls = cb_cls; | 691 | data->cb_cls = cb_cls; |
678 | data->state = OCD_INIT; | ||
679 | opc = GNUNET_malloc (sizeof (struct OperationContext)); | 692 | opc = GNUNET_malloc (sizeof (struct OperationContext)); |
680 | opc->data = data; | 693 | opc->data = data; |
681 | opc->c = p1->controller; | 694 | opc->c = p1->controller; |