diff options
author | Gabor X Toth <*@tg-x.net> | 2014-05-22 23:05:27 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-05-22 23:05:27 +0000 |
commit | a7100389deab562e67d22ff68961b68a62341aec (patch) | |
tree | dbafc72c162df8627e639bd5e5190d8dc321d63d /src/psyc/test_psyc.c | |
parent | c3bc1d8ef6e78e543d0077a57b04ae480f1d7caf (diff) | |
download | gnunet-a7100389deab562e67d22ff68961b68a62341aec.tar.gz gnunet-a7100389deab562e67d22ff68961b68a62341aec.zip |
psyc, multicast: join decision
Diffstat (limited to 'src/psyc/test_psyc.c')
-rw-r--r-- | src/psyc/test_psyc.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/psyc/test_psyc.c b/src/psyc/test_psyc.c index cef8a5dcf..4195e464b 100644 --- a/src/psyc/test_psyc.c +++ b/src/psyc/test_psyc.c | |||
@@ -54,7 +54,6 @@ static GNUNET_SCHEDULER_TaskIdentifier end_badly_task; | |||
54 | 54 | ||
55 | static struct GNUNET_PSYC_Master *mst; | 55 | static struct GNUNET_PSYC_Master *mst; |
56 | static struct GNUNET_PSYC_Slave *slv; | 56 | static struct GNUNET_PSYC_Slave *slv; |
57 | static struct GNUNET_PSYC_Channel *ch; | ||
58 | 57 | ||
59 | static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; | 58 | static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; |
60 | static struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key; | 59 | static struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key; |
@@ -183,7 +182,7 @@ master_message (void *cls, uint64_t message_id, uint32_t flags, | |||
183 | 182 | ||
184 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 183 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
185 | "Master got message part of type %u and size %u " | 184 | "Master got message part of type %u and size %u " |
186 | "belonging to message ID %llu with flags %bu\n", | 185 | "belonging to message ID %llu with flags %xu\n", |
187 | type, size, message_id, flags); | 186 | type, size, message_id, flags); |
188 | 187 | ||
189 | switch (test) | 188 | switch (test) |
@@ -192,7 +191,7 @@ master_message (void *cls, uint64_t message_id, uint32_t flags, | |||
192 | if (GNUNET_PSYC_MESSAGE_REQUEST != flags) | 191 | if (GNUNET_PSYC_MESSAGE_REQUEST != flags) |
193 | { | 192 | { |
194 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 193 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
195 | "Unexpected request flags: %lu\n", flags); | 194 | "Unexpected request flags: %x" PRIu32 "\n", flags); |
196 | GNUNET_assert (0); | 195 | GNUNET_assert (0); |
197 | return; | 196 | return; |
198 | } | 197 | } |
@@ -227,7 +226,7 @@ slave_message (void *cls, uint64_t message_id, uint32_t flags, | |||
227 | 226 | ||
228 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 227 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
229 | "Slave got message part of type %u and size %u " | 228 | "Slave got message part of type %u and size %u " |
230 | "belonging to message ID %llu with flags %bu\n", | 229 | "belonging to message ID %llu with flags %xu\n", |
231 | type, size, message_id, flags); | 230 | type, size, message_id, flags); |
232 | 231 | ||
233 | switch (test) | 232 | switch (test) |
@@ -245,15 +244,18 @@ slave_message (void *cls, uint64_t message_id, uint32_t flags, | |||
245 | 244 | ||
246 | static void | 245 | static void |
247 | join_request (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, | 246 | join_request (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, |
248 | const char *method_name, | 247 | const struct GNUNET_PSYC_MessageHeader *msg, |
249 | size_t variable_count, const struct GNUNET_ENV_Modifier *variables, | ||
250 | const void *data, size_t data_size, | ||
251 | struct GNUNET_PSYC_JoinHandle *jh) | 248 | struct GNUNET_PSYC_JoinHandle *jh) |
252 | { | 249 | { |
250 | struct GNUNET_HashCode slave_key_hash; | ||
251 | GNUNET_CRYPTO_hash (slave_key, sizeof (*slave_key), &slave_key_hash); | ||
253 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 252 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
254 | "Got join request: %s (%zu vars)", method_name, variable_count); | 253 | "Got join request from %s.\n", |
254 | GNUNET_h2s (&slave_key_hash)); | ||
255 | |||
255 | GNUNET_PSYC_join_decision (jh, GNUNET_YES, 0, NULL, "_notice_join", NULL, | 256 | GNUNET_PSYC_join_decision (jh, GNUNET_YES, 0, NULL, "_notice_join", NULL, |
256 | "you're in", 9); | 257 | "you're in", 9); |
258 | // FIXME: also test refusing entry | ||
257 | } | 259 | } |
258 | 260 | ||
259 | 261 | ||
@@ -425,9 +427,8 @@ slave_join () | |||
425 | GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN, | 427 | GNUNET_ENV_environment_add (env, GNUNET_ENV_OP_ASSIGN, |
426 | "_foo_bar", "foo bar baz", 11); | 428 | "_foo_bar", "foo bar baz", 11); |
427 | slv = GNUNET_PSYC_slave_join (cfg, &channel_pub_key, slave_key, &origin, | 429 | slv = GNUNET_PSYC_slave_join (cfg, &channel_pub_key, slave_key, &origin, |
428 | 16, relays, &slave_message, &join_request, | 430 | 16, relays, &slave_message, &slave_joined, NULL, |
429 | &slave_joined, NULL, "_request_join", env, | 431 | "_request_join", env, "some data", 9); |
430 | "some data", 9); | ||
431 | GNUNET_ENV_environment_destroy (env); | 432 | GNUNET_ENV_environment_destroy (env); |
432 | } | 433 | } |
433 | 434 | ||