diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-21 17:25:57 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-21 17:25:57 +0000 |
commit | 91a95b29f1c6f729a1db0de4eeb78648836ea671 (patch) | |
tree | c9f8763b225672444006ff3985d83117ad899b15 /src | |
parent | 4d1382eca0c1c211a3a73a5a158d09269b380530 (diff) | |
download | gnunet-91a95b29f1c6f729a1db0de4eeb78648836ea671.tar.gz gnunet-91a95b29f1c6f729a1db0de4eeb78648836ea671.zip |
tracking forwarded operations
Diffstat (limited to 'src')
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 93 |
1 files changed, 76 insertions, 17 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index b0334b898..ac0ff7562 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c | |||
@@ -666,6 +666,16 @@ struct RequestOverlayConnectContext | |||
666 | struct ForwardedOperationContext | 666 | struct ForwardedOperationContext |
667 | { | 667 | { |
668 | /** | 668 | /** |
669 | * The next pointer for DLL | ||
670 | */ | ||
671 | struct ForwardedOperationContext *next; | ||
672 | |||
673 | /** | ||
674 | * The prev pointer for DLL | ||
675 | */ | ||
676 | struct ForwardedOperationContext *prev; | ||
677 | |||
678 | /** | ||
669 | * The generated operation context | 679 | * The generated operation context |
670 | */ | 680 | */ |
671 | struct OperationContext *opc; | 681 | struct OperationContext *opc; |
@@ -690,6 +700,11 @@ struct ForwardedOperationContext | |||
690 | */ | 700 | */ |
691 | uint64_t operation_id; | 701 | uint64_t operation_id; |
692 | 702 | ||
703 | /** | ||
704 | * The type of the operation which is forwarded | ||
705 | */ | ||
706 | enum OperationType type; | ||
707 | |||
693 | }; | 708 | }; |
694 | 709 | ||
695 | 710 | ||
@@ -826,6 +841,16 @@ static struct RequestOverlayConnectContext *roccq_head; | |||
826 | static struct RequestOverlayConnectContext *roccq_tail; | 841 | static struct RequestOverlayConnectContext *roccq_tail; |
827 | 842 | ||
828 | /** | 843 | /** |
844 | * DLL head for forwarded operation contexts | ||
845 | */ | ||
846 | static struct ForwardedOperationContext *fopcq_head; | ||
847 | |||
848 | /** | ||
849 | * DLL tail for forwarded operation contexts | ||
850 | */ | ||
851 | static struct ForwardedOperationContext *fopcq_tail; | ||
852 | |||
853 | /** | ||
829 | * Array of hosts | 854 | * Array of hosts |
830 | */ | 855 | */ |
831 | static struct GNUNET_TESTBED_Host **host_list; | 856 | static struct GNUNET_TESTBED_Host **host_list; |
@@ -1373,11 +1398,11 @@ forwarded_operation_reply_relay (void *cls, | |||
1373 | msize = ntohs (msg->size); | 1398 | msize = ntohs (msg->size); |
1374 | LOG_DEBUG ("Relaying message with type: %u, size: %u\n", ntohs (msg->type), | 1399 | LOG_DEBUG ("Relaying message with type: %u, size: %u\n", ntohs (msg->type), |
1375 | msize); | 1400 | msize); |
1376 | dup_msg = GNUNET_malloc (msize); | 1401 | dup_msg = GNUNET_copy_message (msg); |
1377 | (void) memcpy (dup_msg, msg, msize); | ||
1378 | queue_message (fopc->client, dup_msg); | 1402 | queue_message (fopc->client, dup_msg); |
1379 | GNUNET_SERVER_client_drop (fopc->client); | 1403 | GNUNET_SERVER_client_drop (fopc->client); |
1380 | GNUNET_SCHEDULER_cancel (fopc->timeout_task); | 1404 | GNUNET_SCHEDULER_cancel (fopc->timeout_task); |
1405 | GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc); | ||
1381 | GNUNET_free (fopc); | 1406 | GNUNET_free (fopc); |
1382 | } | 1407 | } |
1383 | 1408 | ||
@@ -1398,6 +1423,7 @@ forwarded_operation_timeout (void *cls, | |||
1398 | LOG (GNUNET_ERROR_TYPE_WARNING, "A forwarded operation has timed out\n"); | 1423 | LOG (GNUNET_ERROR_TYPE_WARNING, "A forwarded operation has timed out\n"); |
1399 | send_operation_fail_msg (fopc->client, fopc->operation_id, "Timeout"); | 1424 | send_operation_fail_msg (fopc->client, fopc->operation_id, "Timeout"); |
1400 | GNUNET_SERVER_client_drop (fopc->client); | 1425 | GNUNET_SERVER_client_drop (fopc->client); |
1426 | GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc); | ||
1401 | GNUNET_free (fopc); | 1427 | GNUNET_free (fopc); |
1402 | } | 1428 | } |
1403 | 1429 | ||
@@ -1446,6 +1472,7 @@ lcf_forwarded_operation_timeout (void *cls, | |||
1446 | struct LCFContext *lcf = cls; | 1472 | struct LCFContext *lcf = cls; |
1447 | 1473 | ||
1448 | GNUNET_assert (NULL != lcf->fopc); | 1474 | GNUNET_assert (NULL != lcf->fopc); |
1475 | lcf->fopc->timeout_task = GNUNET_SCHEDULER_NO_TASK; | ||
1449 | forwarded_operation_timeout (lcf->fopc, tc); | 1476 | forwarded_operation_timeout (lcf->fopc, tc); |
1450 | lcf->fopc = NULL; | 1477 | lcf->fopc = NULL; |
1451 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); | 1478 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); |
@@ -1502,6 +1529,7 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1502 | lcf->fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); | 1529 | lcf->fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); |
1503 | lcf->fopc->client = lcf->client; | 1530 | lcf->fopc->client = lcf->client; |
1504 | lcf->fopc->operation_id = lcf->operation_id; | 1531 | lcf->fopc->operation_id = lcf->operation_id; |
1532 | lcf->fopc->type = OP_LINK_CONTROLLERS; | ||
1505 | lcf->fopc->opc = | 1533 | lcf->fopc->opc = |
1506 | GNUNET_TESTBED_forward_operation_msg_ (lcf->gateway->controller, | 1534 | GNUNET_TESTBED_forward_operation_msg_ (lcf->gateway->controller, |
1507 | lcf->operation_id, | 1535 | lcf->operation_id, |
@@ -1511,6 +1539,7 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1511 | lcf->fopc->timeout_task = | 1539 | lcf->fopc->timeout_task = |
1512 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &lcf_forwarded_operation_timeout, | 1540 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &lcf_forwarded_operation_timeout, |
1513 | lcf); | 1541 | lcf); |
1542 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, lcf->fopc); | ||
1514 | lcf->state = FINISHED; | 1543 | lcf->state = FINISHED; |
1515 | break; | 1544 | break; |
1516 | case FINISHED: | 1545 | case FINISHED: |
@@ -1621,6 +1650,7 @@ process_next_focc (struct RegisteredHostContext *rhc) | |||
1621 | fopc->client = rhc->client; | 1650 | fopc->client = rhc->client; |
1622 | fopc->operation_id = focc->operation_id; | 1651 | fopc->operation_id = focc->operation_id; |
1623 | fopc->cls = rhc; | 1652 | fopc->cls = rhc; |
1653 | fopc->type = OP_OVERLAY_CONNECT; | ||
1624 | fopc->opc = | 1654 | fopc->opc = |
1625 | GNUNET_TESTBED_forward_operation_msg_ (rhc->gateway->controller, | 1655 | GNUNET_TESTBED_forward_operation_msg_ (rhc->gateway->controller, |
1626 | focc->operation_id, focc->orig_msg, | 1656 | focc->operation_id, focc->orig_msg, |
@@ -1631,6 +1661,7 @@ process_next_focc (struct RegisteredHostContext *rhc) | |||
1631 | fopc->timeout_task = | 1661 | fopc->timeout_task = |
1632 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_overlay_connect_timeout, | 1662 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_overlay_connect_timeout, |
1633 | fopc); | 1663 | fopc); |
1664 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
1634 | } | 1665 | } |
1635 | 1666 | ||
1636 | 1667 | ||
@@ -2204,20 +2235,15 @@ static void | |||
2204 | peer_create_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) | 2235 | peer_create_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) |
2205 | { | 2236 | { |
2206 | struct ForwardedOperationContext *fopc = cls; | 2237 | struct ForwardedOperationContext *fopc = cls; |
2207 | struct GNUNET_MessageHeader *dup_msg; | ||
2208 | struct Peer *remote_peer; | 2238 | struct Peer *remote_peer; |
2209 | 2239 | ||
2210 | GNUNET_SCHEDULER_cancel (fopc->timeout_task); | ||
2211 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS) | 2240 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS) |
2212 | { | 2241 | { |
2213 | GNUNET_assert (NULL != fopc->cls); | 2242 | GNUNET_assert (NULL != fopc->cls); |
2214 | remote_peer = fopc->cls; | 2243 | remote_peer = fopc->cls; |
2215 | peer_list_add (remote_peer); | 2244 | peer_list_add (remote_peer); |
2216 | } | 2245 | } |
2217 | dup_msg = GNUNET_copy_message (msg); | 2246 | forwarded_operation_reply_relay (fopc, msg); |
2218 | queue_message (fopc->client, dup_msg); | ||
2219 | GNUNET_SERVER_client_drop (fopc->client); | ||
2220 | GNUNET_free (fopc); | ||
2221 | } | 2247 | } |
2222 | 2248 | ||
2223 | 2249 | ||
@@ -2259,10 +2285,8 @@ static void | |||
2259 | peer_destroy_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) | 2285 | peer_destroy_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) |
2260 | { | 2286 | { |
2261 | struct ForwardedOperationContext *fopc = cls; | 2287 | struct ForwardedOperationContext *fopc = cls; |
2262 | struct GNUNET_MessageHeader *dup_msg; | ||
2263 | struct Peer *remote_peer; | 2288 | struct Peer *remote_peer; |
2264 | 2289 | ||
2265 | GNUNET_SCHEDULER_cancel (fopc->timeout_task); | ||
2266 | if (GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS == ntohs (msg->type)) | 2290 | if (GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS == ntohs (msg->type)) |
2267 | { | 2291 | { |
2268 | remote_peer = fopc->cls; | 2292 | remote_peer = fopc->cls; |
@@ -2271,10 +2295,7 @@ peer_destroy_success_cb (void *cls, const struct GNUNET_MessageHeader *msg) | |||
2271 | if (0 == remote_peer->reference_cnt) | 2295 | if (0 == remote_peer->reference_cnt) |
2272 | destroy_peer (remote_peer); | 2296 | destroy_peer (remote_peer); |
2273 | } | 2297 | } |
2274 | dup_msg = GNUNET_copy_message (msg); | 2298 | forwarded_operation_reply_relay (fopc, msg); |
2275 | queue_message (fopc->client, dup_msg); | ||
2276 | GNUNET_SERVER_client_drop (fopc->client); | ||
2277 | GNUNET_free (fopc); | ||
2278 | } | 2299 | } |
2279 | 2300 | ||
2280 | 2301 | ||
@@ -2410,6 +2431,7 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
2410 | fo_ctxt->client = client; | 2431 | fo_ctxt->client = client; |
2411 | fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id); | 2432 | fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id); |
2412 | fo_ctxt->cls = peer; //slave_list[route->dest]->controller; | 2433 | fo_ctxt->cls = peer; //slave_list[route->dest]->controller; |
2434 | fo_ctxt->type = OP_PEER_CREATE; | ||
2413 | fo_ctxt->opc = | 2435 | fo_ctxt->opc = |
2414 | GNUNET_TESTBED_forward_operation_msg_ (slave_list [route->dest]->controller, | 2436 | GNUNET_TESTBED_forward_operation_msg_ (slave_list [route->dest]->controller, |
2415 | fo_ctxt->operation_id, | 2437 | fo_ctxt->operation_id, |
@@ -2418,6 +2440,7 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
2418 | fo_ctxt->timeout_task = | 2440 | fo_ctxt->timeout_task = |
2419 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &peer_create_forward_timeout, | 2441 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &peer_create_forward_timeout, |
2420 | fo_ctxt); | 2442 | fo_ctxt); |
2443 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fo_ctxt); | ||
2421 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2444 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2422 | } | 2445 | } |
2423 | 2446 | ||
@@ -2459,6 +2482,7 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client, | |||
2459 | GNUNET_SERVER_client_keep (client); | 2482 | GNUNET_SERVER_client_keep (client); |
2460 | fopc->client = client; | 2483 | fopc->client = client; |
2461 | fopc->cls = peer; | 2484 | fopc->cls = peer; |
2485 | fopc->type = OP_PEER_DESTROY; | ||
2462 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); | 2486 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); |
2463 | fopc->opc = | 2487 | fopc->opc = |
2464 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, | 2488 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, |
@@ -2468,6 +2492,7 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client, | |||
2468 | fopc->timeout_task = | 2492 | fopc->timeout_task = |
2469 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, | 2493 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, |
2470 | fopc); | 2494 | fopc); |
2495 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
2471 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2496 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2472 | return; | 2497 | return; |
2473 | } | 2498 | } |
@@ -2516,6 +2541,7 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client, | |||
2516 | GNUNET_SERVER_client_keep (client); | 2541 | GNUNET_SERVER_client_keep (client); |
2517 | fopc->client = client; | 2542 | fopc->client = client; |
2518 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); | 2543 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); |
2544 | fopc->type = OP_PEER_START; | ||
2519 | fopc->opc = | 2545 | fopc->opc = |
2520 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, | 2546 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, |
2521 | fopc->operation_id, &msg->header, | 2547 | fopc->operation_id, &msg->header, |
@@ -2524,6 +2550,7 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client, | |||
2524 | fopc->timeout_task = | 2550 | fopc->timeout_task = |
2525 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, | 2551 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, |
2526 | fopc); | 2552 | fopc); |
2553 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
2527 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2554 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2528 | return; | 2555 | return; |
2529 | } | 2556 | } |
@@ -2580,6 +2607,7 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client, | |||
2580 | GNUNET_SERVER_client_keep (client); | 2607 | GNUNET_SERVER_client_keep (client); |
2581 | fopc->client = client; | 2608 | fopc->client = client; |
2582 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); | 2609 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); |
2610 | fopc->type = OP_PEER_STOP; | ||
2583 | fopc->opc = | 2611 | fopc->opc = |
2584 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, | 2612 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, |
2585 | fopc->operation_id, &msg->header, | 2613 | fopc->operation_id, &msg->header, |
@@ -2588,6 +2616,7 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client, | |||
2588 | fopc->timeout_task = | 2616 | fopc->timeout_task = |
2589 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, | 2617 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, |
2590 | fopc); | 2618 | fopc); |
2619 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
2591 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2620 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2592 | return; | 2621 | return; |
2593 | } | 2622 | } |
@@ -2650,6 +2679,7 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client, | |||
2650 | GNUNET_SERVER_client_keep (client); | 2679 | GNUNET_SERVER_client_keep (client); |
2651 | fopc->client = client; | 2680 | fopc->client = client; |
2652 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); | 2681 | fopc->operation_id = GNUNET_ntohll (msg->operation_id); |
2682 | fopc->type = OP_PEER_INFO; | ||
2653 | fopc->opc = | 2683 | fopc->opc = |
2654 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, | 2684 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, |
2655 | fopc->operation_id, &msg->header, | 2685 | fopc->operation_id, &msg->header, |
@@ -2657,7 +2687,8 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client, | |||
2657 | fopc); | 2687 | fopc); |
2658 | fopc->timeout_task = | 2688 | fopc->timeout_task = |
2659 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, | 2689 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, |
2660 | fopc); | 2690 | fopc); |
2691 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
2661 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 2692 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
2662 | return; | 2693 | return; |
2663 | } | 2694 | } |
@@ -3273,6 +3304,7 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
3273 | GNUNET_SERVER_client_keep (client); | 3304 | GNUNET_SERVER_client_keep (client); |
3274 | fopc->client = client; | 3305 | fopc->client = client; |
3275 | fopc->operation_id = operation_id; | 3306 | fopc->operation_id = operation_id; |
3307 | fopc->type = OP_OVERLAY_CONNECT; | ||
3276 | fopc->opc = | 3308 | fopc->opc = |
3277 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, | 3309 | GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, |
3278 | operation_id, message, | 3310 | operation_id, message, |
@@ -3281,6 +3313,7 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
3281 | fopc->timeout_task = | 3313 | fopc->timeout_task = |
3282 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, | 3314 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout, |
3283 | fopc); | 3315 | fopc); |
3316 | GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); | ||
3284 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 3317 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
3285 | return; | 3318 | return; |
3286 | } | 3319 | } |
@@ -3566,6 +3599,7 @@ handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client, | |||
3566 | op_id = GNUNET_ntohll (msg->operation_id); | 3599 | op_id = GNUNET_ntohll (msg->operation_id); |
3567 | if ((slave_list_size <= slave_id) || (NULL == slave_list[slave_id])) | 3600 | if ((slave_list_size <= slave_id) || (NULL == slave_list[slave_id])) |
3568 | { | 3601 | { |
3602 | /* FIXME: Add forwardings for this type of message here.. */ | ||
3569 | send_operation_fail_msg (client, op_id, "Slave not found"); | 3603 | send_operation_fail_msg (client, op_id, "Slave not found"); |
3570 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 3604 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
3571 | return; | 3605 | return; |
@@ -3670,6 +3704,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3670 | struct LCFContextQueue *lcfq; | 3704 | struct LCFContextQueue *lcfq; |
3671 | struct OverlayConnectContext *occ; | 3705 | struct OverlayConnectContext *occ; |
3672 | struct RequestOverlayConnectContext *rocc; | 3706 | struct RequestOverlayConnectContext *rocc; |
3707 | struct ForwardedOperationContext *fopc; | ||
3673 | uint32_t id; | 3708 | uint32_t id; |
3674 | 3709 | ||
3675 | shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; | 3710 | shutdown_task_id = GNUNET_SCHEDULER_NO_TASK; |
@@ -3677,6 +3712,32 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3677 | (void) GNUNET_CONTAINER_multihashmap_iterate (ss_map, &ss_map_free_iterator, | 3712 | (void) GNUNET_CONTAINER_multihashmap_iterate (ss_map, &ss_map_free_iterator, |
3678 | NULL); | 3713 | NULL); |
3679 | GNUNET_CONTAINER_multihashmap_destroy (ss_map); | 3714 | GNUNET_CONTAINER_multihashmap_destroy (ss_map); |
3715 | /* cleanup any remaining forwarded operations */ | ||
3716 | while (NULL != (fopc = fopcq_head)) | ||
3717 | { | ||
3718 | GNUNET_CONTAINER_DLL_remove (fopcq_head, fopcq_tail, fopc); | ||
3719 | GNUNET_TESTBED_forward_operation_msg_cancel_ (fopc->opc); | ||
3720 | if (GNUNET_SCHEDULER_NO_TASK != fopc->timeout_task) | ||
3721 | GNUNET_SCHEDULER_cancel (fopc->timeout_task); | ||
3722 | GNUNET_SERVER_client_drop (fopc->client); | ||
3723 | switch (fopc->type) | ||
3724 | { | ||
3725 | case OP_PEER_CREATE: | ||
3726 | GNUNET_free (fopc->cls); | ||
3727 | break; | ||
3728 | case OP_PEER_START: | ||
3729 | case OP_PEER_STOP: | ||
3730 | case OP_PEER_DESTROY: | ||
3731 | case OP_PEER_INFO: | ||
3732 | case OP_OVERLAY_CONNECT: | ||
3733 | case OP_LINK_CONTROLLERS: | ||
3734 | case OP_GET_SLAVE_CONFIG: | ||
3735 | break; | ||
3736 | case OP_FORWARDED: | ||
3737 | GNUNET_assert (0); | ||
3738 | }; | ||
3739 | GNUNET_free (fopc); | ||
3740 | } | ||
3680 | if (NULL != lcfq_head) | 3741 | if (NULL != lcfq_head) |
3681 | { | 3742 | { |
3682 | if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id) | 3743 | if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id) |
@@ -3688,8 +3749,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3688 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); | 3749 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == lcf_proc_task_id); |
3689 | for (lcfq = lcfq_head; NULL != lcfq; lcfq = lcfq_head) | 3750 | for (lcfq = lcfq_head; NULL != lcfq; lcfq = lcfq_head) |
3690 | { | 3751 | { |
3691 | if (NULL != lcfq->lcf->fopc) | ||
3692 | GNUNET_TESTBED_forward_operation_msg_cancel_ (lcfq->lcf->fopc->opc); | ||
3693 | GNUNET_free (lcfq->lcf->msg); | 3752 | GNUNET_free (lcfq->lcf->msg); |
3694 | GNUNET_free (lcfq->lcf); | 3753 | GNUNET_free (lcfq->lcf); |
3695 | GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq); | 3754 | GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq); |