aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-02-14 16:46:58 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-02-14 16:46:58 +0000
commitf13b91df9b44684456a1b60db33a10f6d260f936 (patch)
tree3ec90f68bc77e104dab78077e5a234ad5616b123 /src/testbed/gnunet-service-testbed.c
parent6ec800a7d58bd7e5d79adf2413732c90ba02397a (diff)
downloadgnunet-f13b91df9b44684456a1b60db33a10f6d260f936.tar.gz
gnunet-f13b91df9b44684456a1b60db33a10f6d260f936.zip
fix 2793: Testbed does not allow to set TIMEOUT for operations
Diffstat (limited to 'src/testbed/gnunet-service-testbed.c')
-rw-r--r--src/testbed/gnunet-service-testbed.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index f1dc3fab9..70fe1786f 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -74,6 +74,11 @@ struct ForwardedOperationContext *fopcq_tail;
74struct OperationQueue *GST_opq_openfds; 74struct OperationQueue *GST_opq_openfds;
75 75
76/** 76/**
77 * Timeout for operations which may take some time
78 */
79const struct GNUNET_TIME_Relative GST_timeout;
80
81/**
77 * The size of the host list 82 * The size of the host list
78 */ 83 */
79unsigned int GST_host_list_size; 84unsigned int GST_host_list_size;
@@ -765,7 +770,7 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
765 &lcf_forwarded_operation_reply_relay, 770 &lcf_forwarded_operation_reply_relay,
766 lcf); 771 lcf);
767 lcf->fopc->timeout_task = 772 lcf->fopc->timeout_task =
768 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &lcf_forwarded_operation_timeout, 773 GNUNET_SCHEDULER_add_delayed (GST_timeout, &lcf_forwarded_operation_timeout,
769 lcf); 774 lcf);
770 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, lcf->fopc); 775 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, lcf->fopc);
771 lcf->state = FINISHED; 776 lcf->state = FINISHED;
@@ -1558,7 +1563,7 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
1558 &msg->header, 1563 &msg->header,
1559 peer_create_success_cb, fo_ctxt); 1564 peer_create_success_cb, fo_ctxt);
1560 fo_ctxt->timeout_task = 1565 fo_ctxt->timeout_task =
1561 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &peer_create_forward_timeout, 1566 GNUNET_SCHEDULER_add_delayed (GST_timeout, &peer_create_forward_timeout,
1562 fo_ctxt); 1567 fo_ctxt);
1563 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fo_ctxt); 1568 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fo_ctxt);
1564 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1569 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1610,7 +1615,7 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
1610 fopc->operation_id, &msg->header, 1615 fopc->operation_id, &msg->header,
1611 &peer_destroy_success_cb, fopc); 1616 &peer_destroy_success_cb, fopc);
1612 fopc->timeout_task = 1617 fopc->timeout_task =
1613 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout, 1618 GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
1614 fopc); 1619 fopc);
1615 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); 1620 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
1616 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1621 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1669,7 +1674,7 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
1669 &GST_forwarded_operation_reply_relay, 1674 &GST_forwarded_operation_reply_relay,
1670 fopc); 1675 fopc);
1671 fopc->timeout_task = 1676 fopc->timeout_task =
1672 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout, 1677 GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
1673 fopc); 1678 fopc);
1674 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); 1679 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
1675 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1680 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1739,7 +1744,7 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
1739 &GST_forwarded_operation_reply_relay, 1744 &GST_forwarded_operation_reply_relay,
1740 fopc); 1745 fopc);
1741 fopc->timeout_task = 1746 fopc->timeout_task =
1742 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout, 1747 GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
1743 fopc); 1748 fopc);
1744 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); 1749 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
1745 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1750 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -1815,7 +1820,7 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1815 &GST_forwarded_operation_reply_relay, 1820 &GST_forwarded_operation_reply_relay,
1816 fopc); 1821 fopc);
1817 fopc->timeout_task = 1822 fopc->timeout_task =
1818 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout, 1823 GNUNET_SCHEDULER_add_delayed (GST_timeout, &GST_forwarded_operation_timeout,
1819 fopc); 1824 fopc);
1820 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); 1825 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
1821 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1826 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -2197,8 +2202,14 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
2197 "MAX_OPEN_FDS", &num)); 2202 "MAX_OPEN_FDS", &num));
2198 GST_opq_openfds = GNUNET_TESTBED_operation_queue_create_ ((unsigned int) num); 2203 GST_opq_openfds = GNUNET_TESTBED_operation_queue_create_ ((unsigned int) num);
2199 GNUNET_assert (GNUNET_OK == 2204 GNUNET_assert (GNUNET_OK ==
2205 GNUNET_CONFIGURATION_get_value_time (cfg, "TESTBED",
2206 "OPERATION_TIMEOUT",
2207 (struct
2208 GNUNET_TIME_Relative *)
2209 &GST_timeout));
2210 GNUNET_assert (GNUNET_OK ==
2200 GNUNET_CONFIGURATION_get_value_string (cfg, "testbed", 2211 GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
2201 "HOSTNAME", &hostname)); 2212 "HOSTNAME", &hostname));
2202 our_config = GNUNET_CONFIGURATION_dup (cfg); 2213 our_config = GNUNET_CONFIGURATION_dup (cfg);
2203 GNUNET_SERVER_add_handlers (server, message_handlers); 2214 GNUNET_SERVER_add_handlers (server, message_handlers);
2204 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL); 2215 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);