diff options
Diffstat (limited to 'src/social/test_social.c')
-rw-r--r-- | src/social/test_social.c | 268 |
1 files changed, 156 insertions, 112 deletions
diff --git a/src/social/test_social.c b/src/social/test_social.c index 64ef10125..4d95cf005 100644 --- a/src/social/test_social.c +++ b/src/social/test_social.c | |||
@@ -129,22 +129,22 @@ enum | |||
129 | TEST_HOST_ANSWER_DOOR_REFUSE = 4, | 129 | TEST_HOST_ANSWER_DOOR_REFUSE = 4, |
130 | TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 5, | 130 | TEST_GUEST_RECV_ENTRY_DCSN_REFUSE = 5, |
131 | TEST_HOST_ANSWER_DOOR_ADMIT = 6, | 131 | TEST_HOST_ANSWER_DOOR_ADMIT = 6, |
132 | TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 9, | 132 | TEST_GUEST_RECV_ENTRY_DCSN_ADMIT = 7, |
133 | TEST_HOST_ANNOUNCE = 10, | 133 | TEST_HOST_ANNOUNCE = 8, |
134 | TEST_HOST_ANNOUNCE_END = 11, | 134 | TEST_HOST_ANNOUNCE_END = 9, |
135 | TEST_GUEST_TALK = 12, | 135 | TEST_GUEST_TALK = 10, |
136 | TEST_HOST_ANNOUNCE2 = 13, | 136 | TEST_HOST_ANNOUNCE2 = 11, |
137 | TEST_HOST_ANNOUNCE2_END = 14, | 137 | TEST_HOST_ANNOUNCE2_END = 12, |
138 | TEST_GUEST_HISTORY_REPLAY = 15, | 138 | TEST_GUEST_HISTORY_REPLAY = 13, |
139 | TEST_GUEST_HISTORY_REPLAY_LATEST = 16, | 139 | TEST_GUEST_HISTORY_REPLAY_LATEST = 14, |
140 | TEST_GUEST_LOOK_AT = 17, | 140 | TEST_GUEST_LOOK_AT = 15, |
141 | TEST_GUEST_LOOK_FOR = 18, | 141 | TEST_GUEST_LOOK_FOR = 16, |
142 | TEST_GUEST_LEAVE = 18, | 142 | TEST_GUEST_LEAVE = 17, |
143 | TEST_ZONE_ADD_PLACE = 20, | 143 | TEST_ZONE_ADD_PLACE = 18, |
144 | TEST_GUEST_ENTER_BY_NAME = 21, | 144 | TEST_GUEST_ENTER_BY_NAME = 19, |
145 | TEST_RECONNECT = 22, | 145 | TEST_RECONNECT = 20, |
146 | TEST_GUEST_LEAVE2 = 23, | 146 | TEST_GUEST_LEAVE2 = 21, |
147 | TEST_HOST_LEAVE = 24, | 147 | TEST_HOST_LEAVE = 22, |
148 | } test; | 148 | } test; |
149 | 149 | ||
150 | 150 | ||
@@ -180,10 +180,28 @@ host_announce2 (); | |||
180 | 180 | ||
181 | 181 | ||
182 | /** | 182 | /** |
183 | * Clean up all resources used. | 183 | * Terminate the test case (failure). |
184 | * | ||
185 | * @param cls NULL | ||
186 | */ | ||
187 | static void | ||
188 | end_badly (void *cls) | ||
189 | { | ||
190 | end_badly_task = NULL; | ||
191 | GNUNET_SCHEDULER_shutdown (); | ||
192 | res = 2; | ||
193 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
194 | "Test FAILED.\n"); | ||
195 | } | ||
196 | |||
197 | |||
198 | /** | ||
199 | * Terminate the test case (failure). | ||
200 | * | ||
201 | * @param cls NULL | ||
184 | */ | 202 | */ |
185 | static void | 203 | static void |
186 | cleanup () | 204 | end_shutdown (void *cls) |
187 | { | 205 | { |
188 | if (NULL != id) | 206 | if (NULL != id) |
189 | { | 207 | { |
@@ -202,7 +220,11 @@ cleanup () | |||
202 | GNUNET_PSYC_slicer_destroy (host_slicer); | 220 | GNUNET_PSYC_slicer_destroy (host_slicer); |
203 | host_slicer = NULL; | 221 | host_slicer = NULL; |
204 | } | 222 | } |
205 | 223 | if (NULL != end_badly_task) | |
224 | { | ||
225 | GNUNET_SCHEDULER_cancel (end_badly_task); | ||
226 | end_badly_task = NULL; | ||
227 | } | ||
206 | if (NULL != gst) | 228 | if (NULL != gst) |
207 | { | 229 | { |
208 | GNUNET_SOCIAL_guest_leave (gst, NULL, NULL, NULL); | 230 | GNUNET_SOCIAL_guest_leave (gst, NULL, NULL, NULL); |
@@ -216,21 +238,6 @@ cleanup () | |||
216 | hst_plc = NULL; | 238 | hst_plc = NULL; |
217 | } | 239 | } |
218 | GNUNET_SOCIAL_app_disconnect (app, NULL, NULL); | 240 | GNUNET_SOCIAL_app_disconnect (app, NULL, NULL); |
219 | GNUNET_SCHEDULER_shutdown (); | ||
220 | } | ||
221 | |||
222 | |||
223 | /** | ||
224 | * Terminate the test case (failure). | ||
225 | * | ||
226 | * @param cls NULL | ||
227 | */ | ||
228 | static void | ||
229 | end_badly (void *cls) | ||
230 | { | ||
231 | res = 1; | ||
232 | cleanup (); | ||
233 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Test FAILED.\n"); | ||
234 | } | 241 | } |
235 | 242 | ||
236 | 243 | ||
@@ -242,9 +249,9 @@ end_badly (void *cls) | |||
242 | static void | 249 | static void |
243 | end_normally (void *cls) | 250 | end_normally (void *cls) |
244 | { | 251 | { |
252 | GNUNET_SCHEDULER_shutdown (); | ||
245 | res = 0; | 253 | res = 0; |
246 | cleanup (); | 254 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Test PASSED.\n"); |
247 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test PASSED.\n"); | ||
248 | } | 255 | } |
249 | 256 | ||
250 | 257 | ||
@@ -254,7 +261,7 @@ end_normally (void *cls) | |||
254 | static void | 261 | static void |
255 | end () | 262 | end () |
256 | { | 263 | { |
257 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 264 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
258 | "Test #%u: Ending tests.\n", test); | 265 | "Test #%u: Ending tests.\n", test); |
259 | 266 | ||
260 | if (end_badly_task != NULL) | 267 | if (end_badly_task != NULL) |
@@ -271,7 +278,7 @@ transmit_resume (void *cls) | |||
271 | { | 278 | { |
272 | struct TransmitClosure *tmit = cls; | 279 | struct TransmitClosure *tmit = cls; |
273 | 280 | ||
274 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 281 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
275 | "Test #%u: Transmission resumed.\n", test); | 282 | "Test #%u: Transmission resumed.\n", test); |
276 | if (NULL != tmit->host_ann) | 283 | if (NULL != tmit->host_ann) |
277 | GNUNET_SOCIAL_host_announce_resume (tmit->host_ann); | 284 | GNUNET_SOCIAL_host_announce_resume (tmit->host_ann); |
@@ -296,7 +303,7 @@ notify_data (void *cls, uint16_t *data_size, void *data) | |||
296 | } | 303 | } |
297 | 304 | ||
298 | uint16_t size = strlen (tmit->data[tmit->n]); | 305 | uint16_t size = strlen (tmit->data[tmit->n]); |
299 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 306 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
300 | "Test #%u: Transmit notify data: %u bytes available, " | 307 | "Test #%u: Transmit notify data: %u bytes available, " |
301 | "processing fragment %u/%u (size %u).\n", | 308 | "processing fragment %u/%u (size %u).\n", |
302 | test, *data_size, tmit->n + 1, tmit->data_count, size); | 309 | test, *data_size, tmit->n + 1, tmit->data_count, size); |
@@ -309,7 +316,7 @@ notify_data (void *cls, uint16_t *data_size, void *data) | |||
309 | 316 | ||
310 | if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n]) | 317 | if (GNUNET_YES != tmit->paused && 0 < tmit->data_delay[tmit->n]) |
311 | { | 318 | { |
312 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 319 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
313 | "Test #%u: Transmission paused.\n", test); | 320 | "Test #%u: Transmission paused.\n", test); |
314 | tmit->paused = GNUNET_YES; | 321 | tmit->paused = GNUNET_YES; |
315 | GNUNET_SCHEDULER_add_delayed ( | 322 | GNUNET_SCHEDULER_add_delayed ( |
@@ -331,7 +338,7 @@ notify_data (void *cls, uint16_t *data_size, void *data) | |||
331 | static void | 338 | static void |
332 | host_left () | 339 | host_left () |
333 | { | 340 | { |
334 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 341 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
335 | "Test #%u: The host has left the place.\n", test); | 342 | "Test #%u: The host has left the place.\n", test); |
336 | end (); | 343 | end (); |
337 | } | 344 | } |
@@ -352,7 +359,7 @@ host_farewell2 (void *cls, | |||
352 | const struct GNUNET_SOCIAL_Nym *nym, | 359 | const struct GNUNET_SOCIAL_Nym *nym, |
353 | struct GNUNET_PSYC_Environment *env) | 360 | struct GNUNET_PSYC_Environment *env) |
354 | { | 361 | { |
355 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 362 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
356 | "Nym left the place again.\n"); | 363 | "Nym left the place again.\n"); |
357 | GNUNET_SCHEDULER_add_now (&schedule_host_leave, NULL); | 364 | GNUNET_SCHEDULER_add_now (&schedule_host_leave, NULL); |
358 | } | 365 | } |
@@ -365,13 +372,14 @@ host_reconnected (void *cls, int result, | |||
365 | { | 372 | { |
366 | place_pub_key = *home_pub_key; | 373 | place_pub_key = *home_pub_key; |
367 | GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); | 374 | GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); |
368 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 375 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
369 | "Test #%u: Host reconnected to place %s\n", | 376 | "Test #%u: Host reconnected to place %s\n", |
370 | test, GNUNET_h2s (&place_pub_hash)); | 377 | test, GNUNET_h2s (&place_pub_hash)); |
371 | 378 | ||
372 | is_host_reconnected = GNUNET_YES; | 379 | is_host_reconnected = GNUNET_YES; |
373 | if (GNUNET_YES == is_guest_reconnected) | 380 | if (GNUNET_YES == is_guest_reconnected) |
374 | { | 381 | { |
382 | GNUNET_assert (NULL != gst); | ||
375 | GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); | 383 | GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); |
376 | } | 384 | } |
377 | } | 385 | } |
@@ -382,7 +390,7 @@ guest_reconnected (void *cls, int result, | |||
382 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, | 390 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, |
383 | uint64_t max_message_id) | 391 | uint64_t max_message_id) |
384 | { | 392 | { |
385 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 393 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
386 | "Test #%u: Guest reconnected to place: %d\n", | 394 | "Test #%u: Guest reconnected to place: %d\n", |
387 | test, result); | 395 | test, result); |
388 | GNUNET_assert (0 <= result); | 396 | GNUNET_assert (0 <= result); |
@@ -390,6 +398,7 @@ guest_reconnected (void *cls, int result, | |||
390 | is_guest_reconnected = GNUNET_YES; | 398 | is_guest_reconnected = GNUNET_YES; |
391 | if (GNUNET_YES == is_host_reconnected) | 399 | if (GNUNET_YES == is_host_reconnected) |
392 | { | 400 | { |
401 | GNUNET_assert (NULL != gst); | ||
393 | GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); | 402 | GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); |
394 | } | 403 | } |
395 | } | 404 | } |
@@ -398,7 +407,7 @@ guest_reconnected (void *cls, int result, | |||
398 | static void | 407 | static void |
399 | app_connected (void *cls) | 408 | app_connected (void *cls) |
400 | { | 409 | { |
401 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 410 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
402 | "Test #%u: App connected: %p\n", test, cls); | 411 | "Test #%u: App connected: %p\n", test, cls); |
403 | } | 412 | } |
404 | 413 | ||
@@ -411,21 +420,28 @@ app_recv_host (void *cls, | |||
411 | enum GNUNET_SOCIAL_AppPlaceState place_state) | 420 | enum GNUNET_SOCIAL_AppPlaceState place_state) |
412 | { | 421 | { |
413 | struct GNUNET_HashCode host_pub_hash; | 422 | struct GNUNET_HashCode host_pub_hash; |
414 | GNUNET_CRYPTO_hash (host_pub_key, sizeof (*host_pub_key), &host_pub_hash); | ||
415 | 423 | ||
416 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 424 | GNUNET_CRYPTO_hash (host_pub_key, |
425 | sizeof (*host_pub_key), | ||
426 | &host_pub_hash); | ||
427 | |||
428 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
417 | "Test #%u: Got app host place notification: %s\n", | 429 | "Test #%u: Got app host place notification: %s\n", |
418 | test, GNUNET_h2s (&host_pub_hash)); | 430 | test, |
431 | GNUNET_h2s (&host_pub_hash)); | ||
419 | 432 | ||
420 | if (test == TEST_RECONNECT) | 433 | if (test == TEST_RECONNECT) |
421 | { | 434 | { |
422 | if (0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key))) | 435 | if (0 == memcmp (&place_pub_key, host_pub_key, sizeof (*host_pub_key))) |
423 | { | 436 | { |
424 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 437 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
425 | "Test #%u: Reconnecting to host place: %s\n", | 438 | "Test #%u: Reconnecting to host place: %s\n", |
426 | test, GNUNET_h2s (&host_pub_hash)); | 439 | test, GNUNET_h2s (&host_pub_hash)); |
427 | hst = GNUNET_SOCIAL_host_enter_reconnect (hconn, host_slicer, host_reconnected, | 440 | hst = GNUNET_SOCIAL_host_enter_reconnect (hconn, host_slicer, |
428 | host_answer_door, host_farewell2, NULL); | 441 | &host_reconnected, |
442 | &host_answer_door, | ||
443 | &host_farewell2, | ||
444 | NULL); | ||
429 | } | 445 | } |
430 | } | 446 | } |
431 | } | 447 | } |
@@ -439,21 +455,30 @@ app_recv_guest (void *cls, | |||
439 | enum GNUNET_SOCIAL_AppPlaceState place_state) | 455 | enum GNUNET_SOCIAL_AppPlaceState place_state) |
440 | { | 456 | { |
441 | struct GNUNET_HashCode guest_pub_hash; | 457 | struct GNUNET_HashCode guest_pub_hash; |
442 | GNUNET_CRYPTO_hash (guest_pub_key, sizeof (*guest_pub_key), &guest_pub_hash); | ||
443 | 458 | ||
444 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 459 | GNUNET_CRYPTO_hash (guest_pub_key, |
460 | sizeof (*guest_pub_key), | ||
461 | &guest_pub_hash); | ||
462 | |||
463 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
445 | "Test #%u: Got app guest place notification: %s\n", | 464 | "Test #%u: Got app guest place notification: %s\n", |
446 | test, GNUNET_h2s (&guest_pub_hash)); | 465 | test, GNUNET_h2s (&guest_pub_hash)); |
447 | 466 | ||
448 | if (test == TEST_RECONNECT) | 467 | if (test == TEST_RECONNECT) |
449 | { | 468 | { |
450 | if (0 == memcmp (&place_pub_key, guest_pub_key, sizeof (*guest_pub_key))) | 469 | if (0 == memcmp (&place_pub_key, |
470 | guest_pub_key, | ||
471 | sizeof (*guest_pub_key))) | ||
451 | { | 472 | { |
452 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 473 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
453 | "Test #%u: Reconnecting to guest place: %s\n", | 474 | "Test #%u: Reconnecting to guest place: %s\n", |
454 | test, GNUNET_h2s (&guest_pub_hash)); | 475 | test, GNUNET_h2s (&guest_pub_hash)); |
455 | gst = GNUNET_SOCIAL_guest_enter_reconnect (gconn, GNUNET_PSYC_SLAVE_JOIN_NONE, | 476 | gst = GNUNET_SOCIAL_guest_enter_reconnect (gconn, |
456 | guest_slicer, guest_reconnected, NULL); | 477 | GNUNET_PSYC_SLAVE_JOIN_NONE, |
478 | guest_slicer, | ||
479 | &guest_reconnected, | ||
480 | NULL); | ||
481 | GNUNET_assert (NULL != gst); | ||
457 | } | 482 | } |
458 | } | 483 | } |
459 | } | 484 | } |
@@ -478,7 +503,7 @@ app_recv_ego (void *cls, | |||
478 | const char *name) | 503 | const char *name) |
479 | { | 504 | { |
480 | char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key); | 505 | char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key); |
481 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 506 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
482 | "Test #%u: Got app ego notification: %p %s %s\n", | 507 | "Test #%u: Got app ego notification: %p %s %s\n", |
483 | test, ego, name, ego_pub_str); | 508 | test, ego, name, ego_pub_str); |
484 | GNUNET_free (ego_pub_str); | 509 | GNUNET_free (ego_pub_str); |
@@ -487,15 +512,30 @@ app_recv_ego (void *cls, | |||
487 | { | 512 | { |
488 | host_ego = ego; | 513 | host_ego = ego; |
489 | host_pub_key = ego_pub_key; | 514 | host_pub_key = ego_pub_key; |
490 | GNUNET_assert (TEST_IDENTITIES_CREATE == test); | 515 | if (TEST_IDENTITIES_CREATE == test) |
491 | enter_if_ready (); | 516 | { |
517 | enter_if_ready (); | ||
518 | } | ||
519 | else | ||
520 | { | ||
521 | GNUNET_assert (TEST_RECONNECT == test); | ||
522 | } | ||
492 | } | 523 | } |
493 | else if (NULL != strstr (name, guest_name)) | 524 | else if (NULL != strstr (name, guest_name)) |
494 | { | 525 | { |
495 | guest_ego = ego; | 526 | guest_ego = ego; |
496 | guest_pub_key = ego_pub_key; | 527 | guest_pub_key = ego_pub_key; |
497 | GNUNET_assert (TEST_IDENTITIES_CREATE == test); | 528 | if (TEST_IDENTITIES_CREATE == test) |
498 | enter_if_ready (); | 529 | { |
530 | enter_if_ready (); | ||
531 | } | ||
532 | else | ||
533 | { | ||
534 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
535 | "test = %d\n", | ||
536 | test); | ||
537 | GNUNET_assert (TEST_RECONNECT == test); | ||
538 | } | ||
499 | } | 539 | } |
500 | } | 540 | } |
501 | 541 | ||
@@ -504,7 +544,6 @@ static void | |||
504 | schedule_reconnect (void *cls) | 544 | schedule_reconnect (void *cls) |
505 | { | 545 | { |
506 | test = TEST_RECONNECT; | 546 | test = TEST_RECONNECT; |
507 | |||
508 | GNUNET_SOCIAL_host_disconnect (hst, NULL, NULL); | 547 | GNUNET_SOCIAL_host_disconnect (hst, NULL, NULL); |
509 | GNUNET_SOCIAL_guest_disconnect (gst, NULL, NULL); | 548 | GNUNET_SOCIAL_guest_disconnect (gst, NULL, NULL); |
510 | hst = NULL; | 549 | hst = NULL; |
@@ -512,10 +551,10 @@ schedule_reconnect (void *cls) | |||
512 | 551 | ||
513 | GNUNET_SOCIAL_app_disconnect (app, NULL, NULL); | 552 | GNUNET_SOCIAL_app_disconnect (app, NULL, NULL); |
514 | app = GNUNET_SOCIAL_app_connect (cfg, app_id, | 553 | app = GNUNET_SOCIAL_app_connect (cfg, app_id, |
515 | app_recv_ego, | 554 | &app_recv_ego, |
516 | app_recv_host, | 555 | &app_recv_host, |
517 | app_recv_guest, | 556 | &app_recv_guest, |
518 | app_connected, | 557 | &app_connected, |
519 | NULL); | 558 | NULL); |
520 | } | 559 | } |
521 | 560 | ||
@@ -524,7 +563,7 @@ static void | |||
524 | host_recv_zone_add_place_result (void *cls, int64_t result, | 563 | host_recv_zone_add_place_result (void *cls, int64_t result, |
525 | const void *data, uint16_t data_size) | 564 | const void *data, uint16_t data_size) |
526 | { | 565 | { |
527 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 566 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
528 | "Test #%u: Zone add place result: %" PRId64 " (%.*s).\n", | 567 | "Test #%u: Zone add place result: %" PRId64 " (%.*s).\n", |
529 | test, result, data_size, (const char *) data); | 568 | test, result, data_size, (const char *) data); |
530 | GNUNET_assert (GNUNET_YES == result); | 569 | GNUNET_assert (GNUNET_YES == result); |
@@ -538,7 +577,7 @@ static void | |||
538 | zone_add_place () | 577 | zone_add_place () |
539 | { | 578 | { |
540 | test = TEST_ZONE_ADD_PLACE; | 579 | test = TEST_ZONE_ADD_PLACE; |
541 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 580 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
542 | "Test #%u: Adding place to zone.\n", test); | 581 | "Test #%u: Adding place to zone.\n", test); |
543 | 582 | ||
544 | GNUNET_SOCIAL_zone_add_place (app, host_ego, "home", "let.me*in!", | 583 | GNUNET_SOCIAL_zone_add_place (app, host_ego, "home", "let.me*in!", |
@@ -557,7 +596,7 @@ host_farewell (void *cls, | |||
557 | nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym); | 596 | nym_key = GNUNET_SOCIAL_nym_get_pub_key (nym); |
558 | 597 | ||
559 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (nym_key); | 598 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (nym_key); |
560 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 599 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
561 | "Test #%u: Farewell: nym %s (%s) has left the place.\n", | 600 | "Test #%u: Farewell: nym %s (%s) has left the place.\n", |
562 | test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str); | 601 | test, GNUNET_h2s (GNUNET_SOCIAL_nym_get_pub_key_hash (nym)), str); |
563 | GNUNET_free (str); | 602 | GNUNET_free (str); |
@@ -578,13 +617,13 @@ host_farewell (void *cls, | |||
578 | static void | 617 | static void |
579 | guest_left (void *cls) | 618 | guest_left (void *cls) |
580 | { | 619 | { |
581 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 620 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
582 | "Test #%u: The guest has left the place.\n", test); | 621 | "Test #%u: The guest has left the place.\n", test); |
583 | } | 622 | } |
584 | 623 | ||
585 | 624 | ||
586 | static void | 625 | static void |
587 | guest_leave() | 626 | guest_leave () |
588 | { | 627 | { |
589 | if (test < TEST_RECONNECT) | 628 | if (test < TEST_RECONNECT) |
590 | test = TEST_GUEST_LEAVE; | 629 | test = TEST_GUEST_LEAVE; |
@@ -615,11 +654,11 @@ guest_look_for_result (void *cls, | |||
615 | uint16_t data_size) | 654 | uint16_t data_size) |
616 | { | 655 | { |
617 | struct ResultClosure *rcls = cls; | 656 | struct ResultClosure *rcls = cls; |
618 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 657 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
619 | "Test #%u: guest_look_for_result: %" PRId64 "\n", | 658 | "Test #%u: guest_look_for_result: %" PRId64 "\n", |
620 | test, result_code); | 659 | test, result_code); |
621 | GNUNET_assert (GNUNET_OK == result_code); | 660 | GNUNET_assert (GNUNET_OK == result_code); |
622 | GNUNET_assert (3 == rcls->n); | 661 | GNUNET_assert (6 == rcls->n); |
623 | GNUNET_free (rcls); | 662 | GNUNET_free (rcls); |
624 | GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); | 663 | GNUNET_SCHEDULER_add_now (&schedule_guest_leave, NULL); |
625 | } | 664 | } |
@@ -635,7 +674,7 @@ guest_look_for_var (void *cls, | |||
635 | { | 674 | { |
636 | struct ResultClosure *rcls = cls; | 675 | struct ResultClosure *rcls = cls; |
637 | rcls->n++; | 676 | rcls->n++; |
638 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 677 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
639 | "Test #%u: guest_look_for_var: %s\n%.*s\n", | 678 | "Test #%u: guest_look_for_var: %s\n%.*s\n", |
640 | test, name, value_size, (const char *) value); | 679 | test, name, value_size, (const char *) value); |
641 | } | 680 | } |
@@ -656,7 +695,7 @@ guest_look_at_result (void *cls, int64_t result_code, | |||
656 | { | 695 | { |
657 | struct ResultClosure *rcls = cls; | 696 | struct ResultClosure *rcls = cls; |
658 | 697 | ||
659 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 698 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
660 | "Test #%u: guest_look_at_result: %" PRId64 "\n", | 699 | "Test #%u: guest_look_at_result: %" PRId64 "\n", |
661 | test, result_code); | 700 | test, result_code); |
662 | GNUNET_assert (GNUNET_OK == result_code); | 701 | GNUNET_assert (GNUNET_OK == result_code); |
@@ -677,7 +716,7 @@ guest_look_at_var (void *cls, | |||
677 | struct ResultClosure *rcls = cls; | 716 | struct ResultClosure *rcls = cls; |
678 | rcls->n++; | 717 | rcls->n++; |
679 | 718 | ||
680 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 719 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
681 | "Test #%u: guest_look_at_var: %s\n%.*s\n", | 720 | "Test #%u: guest_look_at_var: %s\n%.*s\n", |
682 | test ,name, value_size, (const char *) value); | 721 | test ,name, value_size, (const char *) value); |
683 | } | 722 | } |
@@ -696,7 +735,7 @@ static void | |||
696 | guest_recv_history_replay_latest_result (void *cls, int64_t result, | 735 | guest_recv_history_replay_latest_result (void *cls, int64_t result, |
697 | const void *data, uint16_t data_size) | 736 | const void *data, uint16_t data_size) |
698 | { | 737 | { |
699 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 738 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
700 | "Test #%u: Guest received latest history replay result " | 739 | "Test #%u: Guest received latest history replay result " |
701 | "(%" PRIu32 " messages, %" PRId64 " fragments):\n" | 740 | "(%" PRIu32 " messages, %" PRId64 " fragments):\n" |
702 | "%.*s\n", | 741 | "%.*s\n", |
@@ -725,7 +764,7 @@ static void | |||
725 | guest_recv_history_replay_result (void *cls, int64_t result, | 764 | guest_recv_history_replay_result (void *cls, int64_t result, |
726 | const void *data, uint16_t data_size) | 765 | const void *data, uint16_t data_size) |
727 | { | 766 | { |
728 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 767 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
729 | "Test #%u: Guest received history replay result: %" PRId64 "\n" | 768 | "Test #%u: Guest received history replay result: %" PRId64 "\n" |
730 | "%.*s\n", | 769 | "%.*s\n", |
731 | test, result, data_size, (const char *) data); | 770 | test, result, data_size, (const char *) data); |
@@ -756,7 +795,7 @@ guest_recv_method (void *cls, | |||
756 | uint64_t message_id, | 795 | uint64_t message_id, |
757 | const char *method_name) | 796 | const char *method_name) |
758 | { | 797 | { |
759 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 798 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
760 | "Test #%u: Guest received method for message ID %" PRIu64 ":\n" | 799 | "Test #%u: Guest received method for message ID %" PRIu64 ":\n" |
761 | "%s (flags: %x)\n", | 800 | "%s (flags: %x)\n", |
762 | test, message_id, method_name, ntohl (meth->flags)); | 801 | test, message_id, method_name, ntohl (meth->flags)); |
@@ -775,7 +814,7 @@ guest_recv_modifier (void *cls, | |||
775 | uint16_t value_size, | 814 | uint16_t value_size, |
776 | uint16_t full_value_size) | 815 | uint16_t full_value_size) |
777 | { | 816 | { |
778 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 817 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
779 | "Test #%u: Guest received modifier for message ID %" PRIu64 ":\n" | 818 | "Test #%u: Guest received modifier for message ID %" PRIu64 ":\n" |
780 | "%c%s: %.*s (size: %u)\n", | 819 | "%c%s: %.*s (size: %u)\n", |
781 | test, message_id, oper, name, value_size, (const char *) value, value_size); | 820 | test, message_id, oper, name, value_size, (const char *) value, value_size); |
@@ -793,7 +832,7 @@ guest_recv_mod_foo_bar (void *cls, | |||
793 | uint16_t value_size, | 832 | uint16_t value_size, |
794 | uint16_t full_value_size) | 833 | uint16_t full_value_size) |
795 | { | 834 | { |
796 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 835 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
797 | "Test #%u: Guest received modifier matching _foo_bar for message ID %" PRIu64 ":\n" | 836 | "Test #%u: Guest received modifier matching _foo_bar for message ID %" PRIu64 ":\n" |
798 | "%c%s: %.*s (size: %u)\n", | 837 | "%c%s: %.*s (size: %u)\n", |
799 | test, message_id, oper, name, value_size, (const char *) value, value_size); | 838 | test, message_id, oper, name, value_size, (const char *) value, value_size); |
@@ -811,7 +850,7 @@ guest_recv_data (void *cls, | |||
811 | const void *data, | 850 | const void *data, |
812 | uint16_t data_size) | 851 | uint16_t data_size) |
813 | { | 852 | { |
814 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 853 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
815 | "Test #%u: Guest received data for message ID %" PRIu64 ":\n" | 854 | "Test #%u: Guest received data for message ID %" PRIu64 ":\n" |
816 | "%.*s\n", | 855 | "%.*s\n", |
817 | test, message_id, data_size, (const char *) data); | 856 | test, message_id, data_size, (const char *) data); |
@@ -826,7 +865,7 @@ guest_recv_eom (void *cls, | |||
826 | uint64_t message_id, | 865 | uint64_t message_id, |
827 | uint8_t is_cancelled) | 866 | uint8_t is_cancelled) |
828 | { | 867 | { |
829 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 868 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
830 | "Test #%u: Guest received end of message ID %" PRIu64 | 869 | "Test #%u: Guest received end of message ID %" PRIu64 |
831 | ", cancelled: %u\n", | 870 | ", cancelled: %u\n", |
832 | test, message_id, is_cancelled); | 871 | test, message_id, is_cancelled); |
@@ -868,7 +907,7 @@ host_recv_method (void *cls, | |||
868 | uint64_t message_id, | 907 | uint64_t message_id, |
869 | const char *method_name) | 908 | const char *method_name) |
870 | { | 909 | { |
871 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 910 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
872 | "Test #%u: Host received method for message ID %" PRIu64 ":\n" | 911 | "Test #%u: Host received method for message ID %" PRIu64 ":\n" |
873 | "%s\n", | 912 | "%s\n", |
874 | test, message_id, method_name); | 913 | test, message_id, method_name); |
@@ -887,7 +926,7 @@ host_recv_modifier (void *cls, | |||
887 | uint16_t value_size, | 926 | uint16_t value_size, |
888 | uint16_t full_value_size) | 927 | uint16_t full_value_size) |
889 | { | 928 | { |
890 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 929 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
891 | "Test #%u: Host received modifier for message ID %" PRIu64 ":\n" | 930 | "Test #%u: Host received modifier for message ID %" PRIu64 ":\n" |
892 | "%c%s: %.*s\n", | 931 | "%c%s: %.*s\n", |
893 | test, message_id, oper, name, value_size, (const char *) value); | 932 | test, message_id, oper, name, value_size, (const char *) value); |
@@ -902,7 +941,7 @@ host_recv_data (void *cls, | |||
902 | const void *data, | 941 | const void *data, |
903 | uint16_t data_size) | 942 | uint16_t data_size) |
904 | { | 943 | { |
905 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 944 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
906 | "Test #%u: Host received data for message ID %" PRIu64 ":\n" | 945 | "Test #%u: Host received data for message ID %" PRIu64 ":\n" |
907 | "%.*s\n", | 946 | "%.*s\n", |
908 | test, message_id, data_size, (const char *) data); | 947 | test, message_id, data_size, (const char *) data); |
@@ -916,7 +955,7 @@ host_recv_eom (void *cls, | |||
916 | uint64_t message_id, | 955 | uint64_t message_id, |
917 | uint8_t is_cancelled) | 956 | uint8_t is_cancelled) |
918 | { | 957 | { |
919 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 958 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
920 | "Test #%u: Host received end of message ID %" PRIu64 | 959 | "Test #%u: Host received end of message ID %" PRIu64 |
921 | ", cancelled: %u\n", | 960 | ", cancelled: %u\n", |
922 | test, message_id, is_cancelled); | 961 | test, message_id, is_cancelled); |
@@ -981,7 +1020,7 @@ host_announce () | |||
981 | { | 1020 | { |
982 | test = TEST_HOST_ANNOUNCE; | 1021 | test = TEST_HOST_ANNOUNCE; |
983 | 1022 | ||
984 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1023 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
985 | "Test #%u: Host announcement.\n", test); | 1024 | "Test #%u: Host announcement.\n", test); |
986 | 1025 | ||
987 | tmit = (struct TransmitClosure) {}; | 1026 | tmit = (struct TransmitClosure) {}; |
@@ -1015,7 +1054,7 @@ host_announce2 () | |||
1015 | 1054 | ||
1016 | test = TEST_HOST_ANNOUNCE2; | 1055 | test = TEST_HOST_ANNOUNCE2; |
1017 | 1056 | ||
1018 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1057 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1019 | "Test #%u: Host announcement 2.\n", test); | 1058 | "Test #%u: Host announcement 2.\n", test); |
1020 | 1059 | ||
1021 | tmit = (struct TransmitClosure) {}; | 1060 | tmit = (struct TransmitClosure) {}; |
@@ -1025,7 +1064,7 @@ host_announce2 () | |||
1025 | GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN, | 1064 | GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN, |
1026 | "_foo2_bar", DATA2ARG ("FOO BAR")); | 1065 | "_foo2_bar", DATA2ARG ("FOO BAR")); |
1027 | GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN, | 1066 | GNUNET_PSYC_env_add (tmit.env, GNUNET_PSYC_OP_ASSIGN, |
1028 | "_foo2_bar", DATA2ARG ("FOO BAR BAZ")); | 1067 | "_foo2_bar_baz", DATA2ARG ("FOO BAR BAZ")); |
1029 | tmit.data[0] = "AAA BBB CCC "; | 1068 | tmit.data[0] = "AAA BBB CCC "; |
1030 | tmit.data[1] = "ABC DEF GHI JKL.\n"; | 1069 | tmit.data[1] = "ABC DEF GHI JKL.\n"; |
1031 | tmit.data[2] = "TESTING ONE TWO THREE.\n"; | 1070 | tmit.data[2] = "TESTING ONE TWO THREE.\n"; |
@@ -1043,7 +1082,7 @@ guest_recv_entry_decision (void *cls, | |||
1043 | int is_admitted, | 1082 | int is_admitted, |
1044 | const struct GNUNET_PSYC_Message *entry_msg) | 1083 | const struct GNUNET_PSYC_Message *entry_msg) |
1045 | { | 1084 | { |
1046 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1085 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1047 | "Test #%u: Guest received entry decision (try %u): %d.\n", | 1086 | "Test #%u: Guest received entry decision (try %u): %d.\n", |
1048 | test, join_req_count, is_admitted); | 1087 | test, join_req_count, is_admitted); |
1049 | 1088 | ||
@@ -1068,7 +1107,8 @@ guest_recv_entry_decision (void *cls, | |||
1068 | { | 1107 | { |
1069 | case TEST_GUEST_RECV_ENTRY_DCSN_REFUSE: | 1108 | case TEST_GUEST_RECV_ENTRY_DCSN_REFUSE: |
1070 | GNUNET_assert (GNUNET_NO == is_admitted); | 1109 | GNUNET_assert (GNUNET_NO == is_admitted); |
1071 | guest_enter (); | 1110 | test = TEST_HOST_ANSWER_DOOR_ADMIT; |
1111 | GNUNET_SOCIAL_guest_disconnect (gst, &guest_enter, NULL); | ||
1072 | break; | 1112 | break; |
1073 | 1113 | ||
1074 | case TEST_GUEST_RECV_ENTRY_DCSN_ADMIT: | 1114 | case TEST_GUEST_RECV_ENTRY_DCSN_ADMIT: |
@@ -1097,7 +1137,7 @@ host_answer_door (void *cls, | |||
1097 | { | 1137 | { |
1098 | join_req_count++; | 1138 | join_req_count++; |
1099 | 1139 | ||
1100 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1140 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1101 | "Test #%u: Host received entry request from guest (try %u).\n", | 1141 | "Test #%u: Host received entry request from guest (try %u).\n", |
1102 | (uint8_t) test, join_req_count); | 1142 | (uint8_t) test, join_req_count); |
1103 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1143 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1118,7 +1158,7 @@ host_answer_door (void *cls, | |||
1118 | // fall through | 1158 | // fall through |
1119 | 1159 | ||
1120 | case TEST_GUEST_ENTER_BY_NAME: | 1160 | case TEST_GUEST_ENTER_BY_NAME: |
1121 | join_resp = GNUNET_PSYC_message_create ("_notice_place_admit", env, | 1161 | join_resp = GNUNET_PSYC_message_create ("_notice_place_admit", env, |
1122 | DATA2ARG ("Welcome, nym!")); | 1162 | DATA2ARG ("Welcome, nym!")); |
1123 | GNUNET_SOCIAL_host_entry_decision (hst, nym, GNUNET_YES, join_resp); | 1163 | GNUNET_SOCIAL_host_entry_decision (hst, nym, GNUNET_YES, join_resp); |
1124 | break; | 1164 | break; |
@@ -1135,18 +1175,18 @@ guest_recv_local_enter (void *cls, int result, | |||
1135 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, | 1175 | const struct GNUNET_CRYPTO_EddsaPublicKey *place_pub_key, |
1136 | uint64_t max_message_id) | 1176 | uint64_t max_message_id) |
1137 | { | 1177 | { |
1138 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1178 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1139 | "Test #%u: Guest entered to local place: %d\n", | 1179 | "Test #%u: Guest entered local place: %d\n", |
1140 | test, result); | 1180 | test, result); |
1141 | GNUNET_assert (0 <= result); | 1181 | GNUNET_assert (GNUNET_OK == result); |
1142 | } | 1182 | } |
1143 | 1183 | ||
1144 | 1184 | ||
1145 | static void | 1185 | static void |
1146 | guest_enter () | 1186 | guest_enter () |
1147 | { | 1187 | { |
1148 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1188 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1149 | "Test #%u: Entering to place as guest.\n", test); | 1189 | "Test #%u: Entering place as guest.\n", test); |
1150 | 1190 | ||
1151 | struct GuestEnterMessage *emsg = &guest_enter_msg; | 1191 | struct GuestEnterMessage *emsg = &guest_enter_msg; |
1152 | 1192 | ||
@@ -1177,8 +1217,8 @@ static void | |||
1177 | guest_enter_by_name () | 1217 | guest_enter_by_name () |
1178 | { | 1218 | { |
1179 | test = TEST_GUEST_ENTER_BY_NAME; | 1219 | test = TEST_GUEST_ENTER_BY_NAME; |
1180 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1220 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1181 | "Test #%u: Entering to place by name as guest.\n", test); | 1221 | "Test #%u: Entering place by name as guest.\n", test); |
1182 | 1222 | ||
1183 | struct GuestEnterMessage *emsg = &guest_enter_msg; | 1223 | struct GuestEnterMessage *emsg = &guest_enter_msg; |
1184 | 1224 | ||
@@ -1222,7 +1262,7 @@ guest_init () | |||
1222 | guest_recv_data, guest_recv_eom, NULL); | 1262 | guest_recv_data, guest_recv_eom, NULL); |
1223 | GNUNET_PSYC_slicer_modifier_add (guest_slicer, "_foo_bar", | 1263 | GNUNET_PSYC_slicer_modifier_add (guest_slicer, "_foo_bar", |
1224 | guest_recv_mod_foo_bar, &mod_foo_bar_rcls); | 1264 | guest_recv_mod_foo_bar, &mod_foo_bar_rcls); |
1225 | test = TEST_HOST_ANSWER_DOOR_ADMIT; | 1265 | test = TEST_HOST_ANSWER_DOOR_REFUSE; |
1226 | 1266 | ||
1227 | GNUNET_SOCIAL_zone_add_nym (app, guest_ego, "host", host_pub_key, | 1267 | GNUNET_SOCIAL_zone_add_nym (app, guest_ego, "host", host_pub_key, |
1228 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES), | 1268 | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES), |
@@ -1270,8 +1310,8 @@ host_entered (void *cls, int result, | |||
1270 | { | 1310 | { |
1271 | place_pub_key = *home_pub_key; | 1311 | place_pub_key = *home_pub_key; |
1272 | GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); | 1312 | GNUNET_CRYPTO_hash (&place_pub_key, sizeof (place_pub_key), &place_pub_hash); |
1273 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1313 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1274 | "Test #%u: Host entered to place %s\n", | 1314 | "Test #%u: Host entered place %s\n", |
1275 | test, GNUNET_h2s (&place_pub_hash)); | 1315 | test, GNUNET_h2s (&place_pub_hash)); |
1276 | guest_enter (); | 1316 | guest_enter (); |
1277 | } | 1317 | } |
@@ -1285,8 +1325,8 @@ host_enter () | |||
1285 | host_recv_method, host_recv_modifier, | 1325 | host_recv_method, host_recv_modifier, |
1286 | host_recv_data, host_recv_eom, NULL); | 1326 | host_recv_data, host_recv_eom, NULL); |
1287 | 1327 | ||
1288 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1328 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1289 | "Test #%u: Entering to place as host.\n", test); | 1329 | "Test #%u: Entering place as host.\n", test); |
1290 | test = TEST_HOST_ENTER; | 1330 | test = TEST_HOST_ENTER; |
1291 | hst = GNUNET_SOCIAL_host_enter (app, host_ego, | 1331 | hst = GNUNET_SOCIAL_host_enter (app, host_ego, |
1292 | GNUNET_PSYC_CHANNEL_PRIVATE, | 1332 | GNUNET_PSYC_CHANNEL_PRIVATE, |
@@ -1306,6 +1346,8 @@ start_app_if_ready () | |||
1306 | { | 1346 | { |
1307 | return; | 1347 | return; |
1308 | } | 1348 | } |
1349 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
1350 | "starting app...\n"); | ||
1309 | app = GNUNET_SOCIAL_app_connect (cfg, | 1351 | app = GNUNET_SOCIAL_app_connect (cfg, |
1310 | app_id, | 1352 | app_id, |
1311 | app_recv_ego, | 1353 | app_recv_ego, |
@@ -1324,17 +1366,17 @@ identity_ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, | |||
1324 | { | 1366 | { |
1325 | if (ego == identity_host_ego) | 1367 | if (ego == identity_host_ego) |
1326 | { | 1368 | { |
1327 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1369 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1328 | "Host ego deleted\n"); | 1370 | "Host ego deleted\n"); |
1329 | } | 1371 | } |
1330 | else if (ego == identity_guest_ego) | 1372 | else if (ego == identity_guest_ego) |
1331 | { | 1373 | { |
1332 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1374 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1333 | "Guest ego deleted\n"); | 1375 | "Guest ego deleted\n"); |
1334 | } | 1376 | } |
1335 | else if (0 == strcmp (name, host_name)) | 1377 | else if (0 == strcmp (name, host_name)) |
1336 | { | 1378 | { |
1337 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1379 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1338 | "Created ego %s\n", | 1380 | "Created ego %s\n", |
1339 | name); | 1381 | name); |
1340 | identity_host_ego = ego; | 1382 | identity_host_ego = ego; |
@@ -1342,7 +1384,7 @@ identity_ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, | |||
1342 | } | 1384 | } |
1343 | else if (0 == strcmp (name, guest_name)) | 1385 | else if (0 == strcmp (name, guest_name)) |
1344 | { | 1386 | { |
1345 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1387 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
1346 | "Created guest ego %s\n", | 1388 | "Created guest ego %s\n", |
1347 | name); | 1389 | name); |
1348 | identity_guest_ego = ego; | 1390 | identity_guest_ego = ego; |
@@ -1370,9 +1412,11 @@ run (void *cls, | |||
1370 | #endif | 1412 | #endif |
1371 | { | 1413 | { |
1372 | cfg = c; | 1414 | cfg = c; |
1415 | res = 1; | ||
1373 | end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 1416 | end_badly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
1374 | &end_badly, NULL); | 1417 | &end_badly, NULL); |
1375 | 1418 | GNUNET_SCHEDULER_add_shutdown (&end_shutdown, | |
1419 | NULL); | ||
1376 | GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer); | 1420 | GNUNET_CRYPTO_get_peer_identity (cfg, &this_peer); |
1377 | 1421 | ||
1378 | id = GNUNET_IDENTITY_connect (cfg, &identity_ego_cb, NULL); | 1422 | id = GNUNET_IDENTITY_connect (cfg, &identity_ego_cb, NULL); |