diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-07-11 15:06:03 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-07-11 15:06:03 +0000 |
commit | 66cf4e437affd0ba540cb2f660986752582ee5b4 (patch) | |
tree | ba87ad143301e3127083f5ddbe1dce5161bb4d93 /src/testbed/test_testbed_api.c | |
parent | c0035396caef1365e0bb52974c192191e33a2af2 (diff) | |
download | gnunet-66cf4e437affd0ba540cb2f660986752582ee5b4.tar.gz gnunet-66cf4e437affd0ba540cb2f660986752582ee5b4.zip |
fixes for controller_start() API changes
Diffstat (limited to 'src/testbed/test_testbed_api.c')
-rw-r--r-- | src/testbed/test_testbed_api.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index 1fdb7169a..849f5ddd4 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c | |||
@@ -43,6 +43,11 @@ | |||
43 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec) | 43 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec) |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * The testing system we work with | ||
47 | */ | ||
48 | struct GNUNET_TESTING_System *test_system; | ||
49 | |||
50 | /** | ||
46 | * Our localhost | 51 | * Our localhost |
47 | */ | 52 | */ |
48 | static struct GNUNET_TESTBED_Host *host; | 53 | static struct GNUNET_TESTBED_Host *host; |
@@ -75,7 +80,7 @@ static struct GNUNET_TESTBED_Peer *peer; | |||
75 | /** | 80 | /** |
76 | * Handle to configuration | 81 | * Handle to configuration |
77 | */ | 82 | */ |
78 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 83 | static struct GNUNET_CONFIGURATION_Handle *cfg; |
79 | 84 | ||
80 | /** | 85 | /** |
81 | * Handle to operation | 86 | * Handle to operation |
@@ -107,10 +112,12 @@ do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
107 | if (NULL != reg_handle) | 112 | if (NULL != reg_handle) |
108 | GNUNET_TESTBED_cancel_registration (reg_handle); | 113 | GNUNET_TESTBED_cancel_registration (reg_handle); |
109 | GNUNET_TESTBED_controller_disconnect (controller); | 114 | GNUNET_TESTBED_controller_disconnect (controller); |
115 | GNUNET_CONFIGURATION_destroy (cfg); | ||
110 | if (NULL != cp) | 116 | if (NULL != cp) |
111 | GNUNET_TESTBED_controller_stop (cp); | 117 | GNUNET_TESTBED_controller_stop (cp); |
112 | GNUNET_TESTBED_host_destroy (neighbour); | 118 | GNUNET_TESTBED_host_destroy (neighbour); |
113 | GNUNET_TESTBED_host_destroy (host); | 119 | GNUNET_TESTBED_host_destroy (host); |
120 | GNUNET_TESTING_system_destroy (test_system, GNUNET_YES); | ||
114 | } | 121 | } |
115 | 122 | ||
116 | 123 | ||
@@ -182,19 +189,19 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
182 | const struct GNUNET_CONFIGURATION_Handle *config) | 189 | const struct GNUNET_CONFIGURATION_Handle *config) |
183 | { | 190 | { |
184 | uint64_t event_mask; | 191 | uint64_t event_mask; |
185 | struct GNUNET_CONFIGURATION_Handle *cdup; | ||
186 | 192 | ||
187 | cfg = config; | 193 | test_system = GNUNET_TESTING_system_create ("test_testbed", |
194 | "127.0.0.1"); | ||
188 | host = GNUNET_TESTBED_host_create (NULL, NULL, 0); | 195 | host = GNUNET_TESTBED_host_create (NULL, NULL, 0); |
189 | GNUNET_assert (NULL != host); | 196 | GNUNET_assert (NULL != host); |
190 | cdup = GNUNET_CONFIGURATION_dup (config); | 197 | cfg = GNUNET_CONFIGURATION_dup (config); |
191 | cp = GNUNET_TESTBED_controller_start (system, host, cdup, NULL, NULL); | 198 | cp = GNUNET_TESTBED_controller_start (test_system, host, cfg, NULL, NULL); |
192 | event_mask = 0; | 199 | event_mask = 0; |
193 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); | 200 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START); |
194 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); | 201 | event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP); |
195 | event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT); | 202 | event_mask |= (1L << GNUNET_TESTBED_ET_CONNECT); |
196 | event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED); | 203 | event_mask |= (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED); |
197 | controller = GNUNET_TESTBED_controller_connect (config, host, event_mask, | 204 | controller = GNUNET_TESTBED_controller_connect (cfg, host, event_mask, |
198 | &controller_cb, NULL); | 205 | &controller_cb, NULL); |
199 | GNUNET_assert (NULL != controller); | 206 | GNUNET_assert (NULL != controller); |
200 | neighbour = GNUNET_TESTBED_host_create ("localhost", NULL, 0); | 207 | neighbour = GNUNET_TESTBED_host_create ("localhost", NULL, 0); |