aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-04-15 12:04:27 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-04-15 12:04:27 +0000
commit2d1d94da00e8aa28c9db86462daf80ab58a3a660 (patch)
treeca933cdf127c671414789dd11da570c1050adaa8 /src
parent9122bceef097dd520e236d04d086d2bd061cc6f9 (diff)
downloadgnunet-2d1d94da00e8aa28c9db86462daf80ab58a3a660.tar.gz
gnunet-2d1d94da00e8aa28c9db86462daf80ab58a3a660.zip
- fixes
Diffstat (limited to 'src')
-rw-r--r--src/testbed/test_testbed_api_controllerlink.c8
-rw-r--r--src/testbed/test_testbed_api_statistics.c2
-rw-r--r--src/testbed/testbed_api.c22
-rw-r--r--src/testbed/testbed_api.h5
-rw-r--r--src/testbed/testbed_api_hosts.c32
-rw-r--r--src/testbed/testbed_api_hosts.h12
6 files changed, 50 insertions, 31 deletions
diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c
index b640dea4c..b3e13f1ff 100644
--- a/src/testbed/test_testbed_api_controllerlink.c
+++ b/src/testbed/test_testbed_api_controllerlink.c
@@ -299,6 +299,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
299 } 299 }
300 if (NULL != hc_handle) 300 if (NULL != hc_handle)
301 GNUNET_TESTBED_is_host_habitable_cancel (hc_handle); 301 GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
302 if (NULL != mc)
303 GNUNET_TESTBED_controller_disconnect (mc);
304 if (NULL != cp)
305 GNUNET_TESTBED_controller_stop (cp);
302 if (NULL != slave3) 306 if (NULL != slave3)
303 GNUNET_TESTBED_host_destroy (slave3); 307 GNUNET_TESTBED_host_destroy (slave3);
304 if (NULL != slave2) 308 if (NULL != slave2)
@@ -307,14 +311,10 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
307 GNUNET_TESTBED_host_destroy (slave); 311 GNUNET_TESTBED_host_destroy (slave);
308 if (NULL != host) 312 if (NULL != host)
309 GNUNET_TESTBED_host_destroy (host); 313 GNUNET_TESTBED_host_destroy (host);
310 if (NULL != mc)
311 GNUNET_TESTBED_controller_disconnect (mc);
312 if (NULL != cfg) 314 if (NULL != cfg)
313 GNUNET_CONFIGURATION_destroy (cfg); 315 GNUNET_CONFIGURATION_destroy (cfg);
314 if (NULL != cfg3) 316 if (NULL != cfg3)
315 GNUNET_CONFIGURATION_destroy (cfg3); 317 GNUNET_CONFIGURATION_destroy (cfg3);
316 if (NULL != cp)
317 GNUNET_TESTBED_controller_stop (cp);
318 if (NULL != rh) 318 if (NULL != rh)
319 GNUNET_TESTBED_cancel_registration (rh); 319 GNUNET_TESTBED_cancel_registration (rh);
320} 320}
diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c
index 82b85f700..bc01f6bc8 100644
--- a/src/testbed/test_testbed_api_statistics.c
+++ b/src/testbed/test_testbed_api_statistics.c
@@ -142,7 +142,7 @@ op_comp_cb (void *cls,
142 GNUNET_TESTBED_operation_done (op); 142 GNUNET_TESTBED_operation_done (op);
143 op = NULL; 143 op = NULL;
144 GNUNET_SCHEDULER_cancel (abort_task); 144 GNUNET_SCHEDULER_cancel (abort_task);
145 GNUNET_SCHEDULER_shutdown (); 145 GNUNET_SCHEDULER_shutdown ();
146} 146}
147 147
148 148
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 869fa2fad..49be33496 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -1335,7 +1335,7 @@ oprelease_get_slave_config (void *cls)
1335 * 1335 *
1336 * @param host host to run the controller on; This should be the same host if 1336 * @param host host to run the controller on; This should be the same host if
1337 * the controller was previously started with 1337 * the controller was previously started with
1338 * GNUNET_TESTBED_controller_start; NULL for localhost 1338 * GNUNET_TESTBED_controller_start()
1339 * @param event_mask bit mask with set of events to call 'cc' for; 1339 * @param event_mask bit mask with set of events to call 'cc' for;
1340 * or-ed values of "1LL" shifted by the 1340 * or-ed values of "1LL" shifted by the
1341 * respective 'enum GNUNET_TESTBED_EventType' 1341 * respective 'enum GNUNET_TESTBED_EventType'
@@ -1394,22 +1394,6 @@ GNUNET_TESTBED_controller_connect (struct GNUNET_TESTBED_Host *host,
1394 GNUNET_TESTBED_controller_disconnect (controller); 1394 GNUNET_TESTBED_controller_disconnect (controller);
1395 return NULL; 1395 return NULL;
1396 } 1396 }
1397 if (NULL == host)
1398 {
1399 host = GNUNET_TESTBED_host_create_by_id_ (0, controller->cfg);
1400 if (NULL == host) /* If the above host create fails */
1401 {
1402 LOG (GNUNET_ERROR_TYPE_WARNING,
1403 "Treating NULL host as localhost. Multiple references to localhost "
1404 "may break when localhost freed before calling disconnect \n");
1405 host = GNUNET_TESTBED_host_lookup_by_id_ (0);
1406 }
1407 else
1408 {
1409 controller->aux_host = GNUNET_YES;
1410 }
1411 }
1412 GNUNET_assert (NULL != host);
1413 GNUNET_TESTBED_mark_host_registered_at_ (host, controller); 1397 GNUNET_TESTBED_mark_host_registered_at_ (host, controller);
1414 controller->host = host; 1398 controller->host = host;
1415 controller->opq_parallel_operations = 1399 controller->opq_parallel_operations =
@@ -1503,9 +1487,9 @@ GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller
1503 } 1487 }
1504 if (NULL != controller->client) 1488 if (NULL != controller->client)
1505 GNUNET_CLIENT_disconnect (controller->client); 1489 GNUNET_CLIENT_disconnect (controller->client);
1490 if (NULL != controller->host)
1491 GNUNET_TESTBED_deregister_host_at_ (controller->host, controller);
1506 GNUNET_CONFIGURATION_destroy (controller->cfg); 1492 GNUNET_CONFIGURATION_destroy (controller->cfg);
1507 if (GNUNET_YES == controller->aux_host)
1508 GNUNET_TESTBED_host_destroy (controller->host);
1509 GNUNET_TESTBED_operation_queue_destroy_ (controller->opq_parallel_operations); 1493 GNUNET_TESTBED_operation_queue_destroy_ (controller->opq_parallel_operations);
1510 GNUNET_TESTBED_operation_queue_destroy_ 1494 GNUNET_TESTBED_operation_queue_destroy_
1511 (controller->opq_parallel_service_connections); 1495 (controller->opq_parallel_service_connections);
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h
index eea191256..7c7edff5f 100644
--- a/src/testbed/testbed_api.h
+++ b/src/testbed/testbed_api.h
@@ -275,11 +275,6 @@ struct GNUNET_TESTBED_Controller
275 int in_receive; 275 int in_receive;
276 276
277 /** 277 /**
278 * Did we create the host for this?
279 */
280 int aux_host;
281
282 /**
283 * The operation id counter. use current value and increment 278 * The operation id counter. use current value and increment
284 */ 279 */
285 uint32_t operation_counter; 280 uint32_t operation_counter;
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index e5b6d0a0b..0774c023e 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -806,6 +806,32 @@ GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
806 806
807 807
808/** 808/**
809 * Unmarks a host registered at a controller
810 *
811 * @param host the host to unmark
812 * @param controller the controller at which this host has to be unmarked
813 */
814void
815GNUNET_TESTBED_deregister_host_at_ (struct GNUNET_TESTBED_Host *host,
816 const struct GNUNET_TESTBED_Controller
817 *const controller)
818{
819 struct RegisteredController *rc;
820
821 for (rc = host->rc_head; NULL != rc; rc=rc->next)
822 if (controller == rc->controller)
823 break;
824 if (NULL == rc)
825 {
826 GNUNET_break (0);
827 return;
828 }
829 GNUNET_CONTAINER_DLL_remove (host->rc_head, host->rc_tail, rc);
830 GNUNET_free (rc);
831}
832
833
834/**
809 * Checks whether a host has been registered 835 * Checks whether a host has been registered
810 * 836 *
811 * @param host the host to check 837 * @param host the host to check
@@ -1353,6 +1379,7 @@ call_cb:
1353 cb = h->cb; 1379 cb = h->cb;
1354 cb_cls = h->cb_cls; 1380 cb_cls = h->cb_cls;
1355 host = h->host; 1381 host = h->host;
1382 free_argv (h->helper_argv);
1356 GNUNET_free (h); 1383 GNUNET_free (h);
1357 if (NULL != cb) 1384 if (NULL != cb)
1358 cb (cb_cls, host, ret); 1385 cb (cb_cls, host, ret);
@@ -1409,10 +1436,11 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
1409 stat_args[0] = "stat"; 1436 stat_args[0] = "stat";
1410 stat_args[2] = NULL; 1437 stat_args[2] = NULL;
1411 rsh_suffix_args = gen_rsh_suffix_args ((const char **) stat_args); 1438 rsh_suffix_args = gen_rsh_suffix_args ((const char **) stat_args);
1439 GNUNET_free (stat_args[1]);
1412 h->helper_argv = join_argv ((const char **) rsh_args, 1440 h->helper_argv = join_argv ((const char **) rsh_args,
1413 (const char **) rsh_suffix_args); 1441 (const char **) rsh_suffix_args);
1414 GNUNET_free (rsh_suffix_args); 1442 free_argv (rsh_suffix_args);
1415 GNUNET_free (rsh_args); 1443 free_argv (rsh_args);
1416 h->auxp = 1444 h->auxp =
1417 GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, NULL, 1445 GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, NULL,
1418 NULL, h->helper_argv[0], h->helper_argv); 1446 NULL, h->helper_argv[0], h->helper_argv);
diff --git a/src/testbed/testbed_api_hosts.h b/src/testbed/testbed_api_hosts.h
index 6e2889eee..56cca624b 100644
--- a/src/testbed/testbed_api_hosts.h
+++ b/src/testbed/testbed_api_hosts.h
@@ -126,6 +126,18 @@ GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
126 126
127 127
128/** 128/**
129 * Unmarks a host registered at a controller
130 *
131 * @param host the host to unmark
132 * @param controller the controller at which this host has to be unmarked
133 */
134void
135GNUNET_TESTBED_deregister_host_at_ (struct GNUNET_TESTBED_Host *host,
136 const struct GNUNET_TESTBED_Controller
137 *const controller);
138
139
140/**
129 * Checks whether a host has been registered with the given controller 141 * Checks whether a host has been registered with the given controller
130 * 142 *
131 * @param host the host to check 143 * @param host the host to check