diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-07-20 12:02:27 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-07-20 12:02:27 +0000 |
commit | 15f4d07a0a03d4c2358c92976cca4708fcca7ff4 (patch) | |
tree | 16b30b28c0e2564447d72725c758c47b14698129 /src/testbed/test_testbed_api_2peers.c | |
parent | a5d6aecaeb8fac43d885d5e8cfad3d33b8f271b4 (diff) | |
download | gnunet-15f4d07a0a03d4c2358c92976cca4708fcca7ff4.tar.gz gnunet-15f4d07a0a03d4c2358c92976cca4708fcca7ff4.zip |
peer create callback
Diffstat (limited to 'src/testbed/test_testbed_api_2peers.c')
-rw-r--r-- | src/testbed/test_testbed_api_2peers.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/testbed/test_testbed_api_2peers.c b/src/testbed/test_testbed_api_2peers.c index 9f55b61eb..c8422ba9d 100644 --- a/src/testbed/test_testbed_api_2peers.c +++ b/src/testbed/test_testbed_api_2peers.c | |||
@@ -154,6 +154,30 @@ controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event) | |||
154 | 154 | ||
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Functions of this signature are called when a peer has been successfully | ||
158 | * created | ||
159 | * | ||
160 | * @param cls the closure from GNUNET_TESTBED_peer_create() | ||
161 | * @param peer the handle for the created peer; NULL on any error during | ||
162 | * creation | ||
163 | * @param emsg NULL if peer is not NULL; else MAY contain the error description | ||
164 | */ | ||
165 | static void | ||
166 | peer_create_cb (void *cls, | ||
167 | struct GNUNET_TESTBED_Peer *peer, const char *emsg) | ||
168 | { | ||
169 | struct GNUNET_TESTBED_Peer **peer_ptr; | ||
170 | |||
171 | peer_ptr = cls; | ||
172 | GNUNET_assert (NULL != peer); | ||
173 | GNUNET_assert (NULL != peer_ptr); | ||
174 | *peer_ptr = peer; | ||
175 | operation = GNUNET_TESTBED_peer_destroy (peer); | ||
176 | GNUNET_assert (NULL != operation); | ||
177 | } | ||
178 | |||
179 | |||
180 | /** | ||
157 | * Callback which will be called to after a host registration succeeded or failed | 181 | * Callback which will be called to after a host registration succeeded or failed |
158 | * | 182 | * |
159 | * @param cls the host which has been registered | 183 | * @param cls the host which has been registered |
@@ -164,9 +188,7 @@ registration_comp (void *cls, const char *emsg) | |||
164 | { | 188 | { |
165 | GNUNET_assert (cls == neighbour); | 189 | GNUNET_assert (cls == neighbour); |
166 | reg_handle = NULL; | 190 | reg_handle = NULL; |
167 | peer = GNUNET_TESTBED_peer_create (controller, host, cfg); | 191 | operation = GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb, &peer); |
168 | GNUNET_assert (NULL != peer); | ||
169 | operation = GNUNET_TESTBED_peer_destroy (peer); | ||
170 | GNUNET_assert (NULL != operation); | 192 | GNUNET_assert (NULL != operation); |
171 | } | 193 | } |
172 | 194 | ||