diff options
Diffstat (limited to 'src/testing/testing.c')
-rw-r--r-- | src/testing/testing.c | 161 |
1 files changed, 20 insertions, 141 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c index 70da138a7..16cee9037 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -97,11 +97,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
97 | GNUNET_NO, &test_address, &empty); | 97 | GNUNET_NO, &test_address, &empty); |
98 | if (GNUNET_YES == empty) | 98 | if (GNUNET_YES == empty) |
99 | { | 99 | { |
100 | #if DEBUG_TESTING | ||
101 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
102 | "Skipping empty HELLO address of peer %s\n", | 101 | "Skipping empty HELLO address of peer %s\n", |
103 | GNUNET_i2s (&daemon->id)); | 102 | GNUNET_i2s (&daemon->id)); |
104 | #endif | ||
105 | return; | 103 | return; |
106 | } | 104 | } |
107 | #endif | 105 | #endif |
@@ -113,11 +111,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
113 | 111 | ||
114 | if (daemon->server != NULL) | 112 | if (daemon->server != NULL) |
115 | { | 113 | { |
116 | #if DEBUG_TESTING | ||
117 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
118 | "Received `%s' from transport service of `%4s', disconnecting core!\n", | 115 | "Received `%s' from transport service of `%4s', disconnecting core!\n", |
119 | "HELLO", GNUNET_i2s (&daemon->id)); | 116 | "HELLO", GNUNET_i2s (&daemon->id)); |
120 | #endif | ||
121 | GNUNET_CORE_disconnect (daemon->server); | 117 | GNUNET_CORE_disconnect (daemon->server); |
122 | daemon->server = NULL; | 118 | daemon->server = NULL; |
123 | } | 119 | } |
@@ -135,12 +131,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
135 | GNUNET_TRANSPORT_get_hello_cancel (daemon->ghh); | 131 | GNUNET_TRANSPORT_get_hello_cancel (daemon->ghh); |
136 | daemon->ghh = NULL; | 132 | daemon->ghh = NULL; |
137 | } | 133 | } |
138 | #if DEBUG_TESTING | ||
139 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 134 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
140 | "Received `%s' from transport service of `%4s'\n", "HELLO", | 135 | "Received `%s' from transport service of `%4s'\n", "HELLO", |
141 | GNUNET_i2s (&daemon->id)); | 136 | GNUNET_i2s (&daemon->id)); |
142 | #endif | ||
143 | |||
144 | GNUNET_free_non_null (daemon->hello); | 137 | GNUNET_free_non_null (daemon->hello); |
145 | daemon->hello = GNUNET_malloc (msize); | 138 | daemon->hello = GNUNET_malloc (msize); |
146 | memcpy (daemon->hello, message, msize); | 139 | memcpy (daemon->hello, message, msize); |
@@ -192,11 +185,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
192 | char *dst; | 185 | char *dst; |
193 | int bytes_read; | 186 | int bytes_read; |
194 | 187 | ||
195 | #if DEBUG_TESTING | ||
196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %s FSM is in phase %u.\n", | 188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %s FSM is in phase %u.\n", |
197 | GNUNET_i2s (&d->id), d->phase); | 189 | GNUNET_i2s (&d->id), d->phase); |
198 | #endif | ||
199 | |||
200 | d->task = GNUNET_SCHEDULER_NO_TASK; | 190 | d->task = GNUNET_SCHEDULER_NO_TASK; |
201 | switch (d->phase) | 191 | switch (d->phase) |
202 | { | 192 | { |
@@ -229,10 +219,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
229 | return; | 219 | return; |
230 | } | 220 | } |
231 | GNUNET_OS_process_close (d->proc); | 221 | GNUNET_OS_process_close (d->proc); |
232 | #if DEBUG_TESTING | ||
233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 222 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
234 | "Successfully copied configuration file.\n"); | 223 | "Successfully copied configuration file.\n"); |
235 | #endif | ||
236 | d->phase = SP_COPIED; | 224 | d->phase = SP_COPIED; |
237 | /* fall-through */ | 225 | /* fall-through */ |
238 | case SP_COPIED: | 226 | case SP_COPIED: |
@@ -254,14 +242,12 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
254 | } | 242 | } |
255 | if (NULL == d->hostname) | 243 | if (NULL == d->hostname) |
256 | { | 244 | { |
257 | #if DEBUG_TESTING | ||
258 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
259 | "Starting `%s', with command `%s %s %s %s'.\n", | 246 | "Starting `%s', with command `%s %s %s %s'.\n", |
260 | "gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile, | 247 | "gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile, |
261 | "-sq"); | 248 | "-sq"); |
262 | #endif | ||
263 | d->proc = | 249 | d->proc = |
264 | GNUNET_OS_start_process (NULL, d->pipe_stdout, "gnunet-peerinfo", | 250 | GNUNET_OS_start_process (GNUNET_YES, NULL, d->pipe_stdout, "gnunet-peerinfo", |
265 | "gnunet-peerinfo", "-c", d->cfgfile, "-sq", | 251 | "gnunet-peerinfo", "-c", d->cfgfile, "-sq", |
266 | NULL); | 252 | NULL); |
267 | GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE); | 253 | GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE); |
@@ -273,15 +259,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
273 | else | 259 | else |
274 | dst = GNUNET_strdup (d->hostname); | 260 | dst = GNUNET_strdup (d->hostname); |
275 | 261 | ||
276 | #if DEBUG_TESTING | ||
277 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 262 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
278 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", | 263 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", |
279 | "gnunet-peerinfo", "ssh", dst, "gnunet-peerinfo", "-c", | 264 | "gnunet-peerinfo", "ssh", dst, "gnunet-peerinfo", "-c", |
280 | d->cfgfile, "-sq"); | 265 | d->cfgfile, "-sq"); |
281 | #endif | ||
282 | if (d->ssh_port_str == NULL) | 266 | if (d->ssh_port_str == NULL) |
283 | { | 267 | { |
284 | d->proc = GNUNET_OS_start_process (NULL, d->pipe_stdout, "ssh", "ssh", | 268 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", |
285 | #if !DEBUG_TESTING | 269 | #if !DEBUG_TESTING |
286 | "-q", | 270 | "-q", |
287 | #endif | 271 | #endif |
@@ -291,7 +275,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
291 | else | 275 | else |
292 | { | 276 | { |
293 | d->proc = | 277 | d->proc = |
294 | GNUNET_OS_start_process (NULL, d->pipe_stdout, "ssh", "ssh", "-p", | 278 | GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", "-p", |
295 | d->ssh_port_str, | 279 | d->ssh_port_str, |
296 | #if !DEBUG_TESTING | 280 | #if !DEBUG_TESTING |
297 | "-q", | 281 | "-q", |
@@ -317,10 +301,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
317 | GNUNET_DISK_pipe_close (d->pipe_stdout); | 301 | GNUNET_DISK_pipe_close (d->pipe_stdout); |
318 | return; | 302 | return; |
319 | } | 303 | } |
320 | #if DEBUG_TESTING | ||
321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
322 | "Started `%s', waiting for hostkey.\n", "gnunet-peerinfo"); | 305 | "Started `%s', waiting for hostkey.\n", "gnunet-peerinfo"); |
323 | #endif | ||
324 | d->phase = SP_HOSTKEY_CREATE; | 306 | d->phase = SP_HOSTKEY_CREATE; |
325 | d->task = | 307 | d->task = |
326 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_absolute_get_remaining | 308 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_absolute_get_remaining |
@@ -410,9 +392,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
410 | { | 392 | { |
411 | d->phase = SP_TOPOLOGY_SETUP; | 393 | d->phase = SP_TOPOLOGY_SETUP; |
412 | } | 394 | } |
413 | #if DEBUG_TESTING | ||
414 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully got hostkey!\n"); | 395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully got hostkey!\n"); |
415 | #endif | ||
416 | /* Fall through */ | 396 | /* Fall through */ |
417 | case SP_HOSTKEY_CREATED: | 397 | case SP_HOSTKEY_CREATED: |
418 | /* wait for topology finished */ | 398 | /* wait for topology finished */ |
@@ -435,18 +415,14 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
435 | /* start GNUnet on remote host */ | 415 | /* start GNUnet on remote host */ |
436 | if (NULL == d->hostname) | 416 | if (NULL == d->hostname) |
437 | { | 417 | { |
438 | #if DEBUG_TESTING | ||
439 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 418 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
440 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", | 419 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", |
441 | "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, "-L", "DEBUG", | 420 | "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, "-L", "DEBUG", |
442 | "-s"); | 421 | "-s"); |
443 | #endif | ||
444 | d->proc = | 422 | d->proc = |
445 | GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", "-c", | 423 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c", |
446 | d->cfgfile, | 424 | d->cfgfile, |
447 | #if DEBUG_TESTING | ||
448 | "-L", "DEBUG", | 425 | "-L", "DEBUG", |
449 | #endif | ||
450 | "-s", "-q", "-T", | 426 | "-s", "-q", "-T", |
451 | GNUNET_TIME_relative_to_string | 427 | GNUNET_TIME_relative_to_string |
452 | (GNUNET_TIME_absolute_get_remaining | 428 | (GNUNET_TIME_absolute_get_remaining |
@@ -459,15 +435,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
459 | else | 435 | else |
460 | dst = GNUNET_strdup (d->hostname); | 436 | dst = GNUNET_strdup (d->hostname); |
461 | 437 | ||
462 | #if DEBUG_TESTING | ||
463 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 438 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
464 | "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n", | 439 | "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n", |
465 | "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile, | 440 | "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile, |
466 | "-L", "DEBUG", "-s", "-q"); | 441 | "-L", "DEBUG", "-s", "-q"); |
467 | #endif | ||
468 | if (d->ssh_port_str == NULL) | 442 | if (d->ssh_port_str == NULL) |
469 | { | 443 | { |
470 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 444 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
471 | #if !DEBUG_TESTING | 445 | #if !DEBUG_TESTING |
472 | "-q", | 446 | "-q", |
473 | #endif | 447 | #endif |
@@ -484,7 +458,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
484 | { | 458 | { |
485 | 459 | ||
486 | d->proc = | 460 | d->proc = |
487 | GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", "-p", | 461 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-p", |
488 | d->ssh_port_str, | 462 | d->ssh_port_str, |
489 | #if !DEBUG_TESTING | 463 | #if !DEBUG_TESTING |
490 | "-q", | 464 | "-q", |
@@ -514,11 +488,9 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
514 | _("Failed to start `ssh' process.\n")); | 488 | _("Failed to start `ssh' process.\n")); |
515 | return; | 489 | return; |
516 | } | 490 | } |
517 | #if DEBUG_TESTING | ||
518 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 491 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
519 | "Started `%s', waiting for `%s' to be up.\n", "gnunet-arm", | 492 | "Started `%s', waiting for `%s' to be up.\n", "gnunet-arm", |
520 | "gnunet-service-core"); | 493 | "gnunet-service-core"); |
521 | #endif | ||
522 | d->phase = SP_START_ARMING; | 494 | d->phase = SP_START_ARMING; |
523 | d->task = | 495 | d->task = |
524 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT, &start_fsm, | 496 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT, &start_fsm, |
@@ -561,15 +533,11 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
561 | d); | 533 | d); |
562 | return; | 534 | return; |
563 | } | 535 | } |
564 | #if DEBUG_TESTING | ||
565 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully started `%s'.\n", | 536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully started `%s'.\n", |
566 | "gnunet-arm"); | 537 | "gnunet-arm"); |
567 | #endif | ||
568 | GNUNET_free (d->proc); | 538 | GNUNET_free (d->proc); |
569 | d->phase = SP_START_CORE; | 539 | d->phase = SP_START_CORE; |
570 | #if DEBUG_TESTING | ||
571 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling CORE_connect\n"); | 540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling CORE_connect\n"); |
572 | #endif | ||
573 | /* Fall through */ | 541 | /* Fall through */ |
574 | case SP_START_CORE: | 542 | case SP_START_CORE: |
575 | if (d->server != NULL) | 543 | if (d->server != NULL) |
@@ -588,12 +556,9 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
588 | _("Failed to connect to transport service!\n")); | 556 | _("Failed to connect to transport service!\n")); |
589 | return; | 557 | return; |
590 | } | 558 | } |
591 | #if DEBUG_TESTING | ||
592 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 559 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
593 | "Connected to transport service `%s', getting HELLO\n", | 560 | "Connected to transport service `%s', getting HELLO\n", |
594 | GNUNET_i2s (&d->id)); | 561 | GNUNET_i2s (&d->id)); |
595 | #endif | ||
596 | |||
597 | d->ghh = GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); | 562 | d->ghh = GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); |
598 | /* FIXME: store task ID somewhere! */ | 563 | /* FIXME: store task ID somewhere! */ |
599 | GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d); | 564 | GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d); |
@@ -669,9 +634,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
669 | return; | 634 | return; |
670 | } | 635 | } |
671 | #endif | 636 | #endif |
672 | #if DEBUG_TESTING | ||
673 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service startup complete!\n"); | 637 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service startup complete!\n"); |
674 | #endif | ||
675 | cb = d->cb; | 638 | cb = d->cb; |
676 | d->cb = NULL; | 639 | d->cb = NULL; |
677 | d->phase = SP_START_DONE; | 640 | d->phase = SP_START_DONE; |
@@ -706,9 +669,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
706 | return; | 669 | return; |
707 | } | 670 | } |
708 | #endif | 671 | #endif |
709 | #if DEBUG_TESTING | ||
710 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); | 672 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); |
711 | #endif | ||
712 | if (NULL != d->dead_cb) | 673 | if (NULL != d->dead_cb) |
713 | d->dead_cb (d->dead_cb_cls, NULL); | 674 | d->dead_cb (d->dead_cb_cls, NULL); |
714 | break; | 675 | break; |
@@ -784,9 +745,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
784 | GNUNET_free (d); | 745 | GNUNET_free (d); |
785 | return; | 746 | return; |
786 | } | 747 | } |
787 | #if DEBUG_TESTING | ||
788 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer shutdown complete.\n"); | 748 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer shutdown complete.\n"); |
789 | #endif | ||
790 | if (d->server != NULL) | 749 | if (d->server != NULL) |
791 | { | 750 | { |
792 | GNUNET_CORE_disconnect (d->server); | 751 | GNUNET_CORE_disconnect (d->server); |
@@ -849,10 +808,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
849 | d->update_cb (d->update_cb_cls, _("`scp' did not complete cleanly.\n")); | 808 | d->update_cb (d->update_cb_cls, _("`scp' did not complete cleanly.\n")); |
850 | return; | 809 | return; |
851 | } | 810 | } |
852 | #if DEBUG_TESTING | ||
853 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 811 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
854 | "Successfully copied configuration file.\n"); | 812 | "Successfully copied configuration file.\n"); |
855 | #endif | ||
856 | if (NULL != d->update_cb) | 813 | if (NULL != d->update_cb) |
857 | d->update_cb (d->update_cb_cls, NULL); | 814 | d->update_cb (d->update_cb_cls, NULL); |
858 | d->phase = SP_START_DONE; | 815 | d->phase = SP_START_DONE; |
@@ -937,18 +894,15 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, | |||
937 | /* Check if this is a local or remote process */ | 894 | /* Check if this is a local or remote process */ |
938 | if (NULL != d->hostname) | 895 | if (NULL != d->hostname) |
939 | { | 896 | { |
940 | #if DEBUG_TESTING | ||
941 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 897 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
942 | "Starting gnunet-arm with config `%s' on host `%s'.\n", | 898 | "Starting gnunet-arm with config `%s' on host `%s'.\n", |
943 | d->cfgfile, d->hostname); | 899 | d->cfgfile, d->hostname); |
944 | #endif | ||
945 | |||
946 | if (d->username != NULL) | 900 | if (d->username != NULL) |
947 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 901 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
948 | else | 902 | else |
949 | arg = GNUNET_strdup (d->hostname); | 903 | arg = GNUNET_strdup (d->hostname); |
950 | 904 | ||
951 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 905 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
952 | #if !DEBUG_TESTING | 906 | #if !DEBUG_TESTING |
953 | "-q", | 907 | "-q", |
954 | #endif | 908 | #endif |
@@ -967,11 +921,9 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, | |||
967 | } | 921 | } |
968 | else | 922 | else |
969 | { | 923 | { |
970 | #if DEBUG_TESTING | ||
971 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 924 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
972 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); | 925 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); |
973 | #endif | 926 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
974 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
975 | #if DEBUG_TESTING | 927 | #if DEBUG_TESTING |
976 | "-L", "DEBUG", | 928 | "-L", "DEBUG", |
977 | #endif | 929 | #endif |
@@ -1010,29 +962,23 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | |||
1010 | GNUNET_assert (d->running == GNUNET_YES); | 962 | GNUNET_assert (d->running == GNUNET_YES); |
1011 | GNUNET_assert (d->phase == SP_START_DONE); | 963 | GNUNET_assert (d->phase == SP_START_DONE); |
1012 | 964 | ||
1013 | #if DEBUG_TESTING | ||
1014 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 965 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1015 | _("Starting service %s for peer `%4s'\n"), service, | 966 | _("Starting service %s for peer `%4s'\n"), service, |
1016 | GNUNET_i2s (&d->id)); | 967 | GNUNET_i2s (&d->id)); |
1017 | #endif | ||
1018 | |||
1019 | d->phase = SP_SERVICE_START; | 968 | d->phase = SP_SERVICE_START; |
1020 | d->max_timeout = GNUNET_TIME_relative_to_absolute (timeout); | 969 | d->max_timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1021 | /* Check if this is a local or remote process */ | 970 | /* Check if this is a local or remote process */ |
1022 | if (NULL != d->hostname) | 971 | if (NULL != d->hostname) |
1023 | { | 972 | { |
1024 | #if DEBUG_TESTING | ||
1025 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1026 | "Starting gnunet-arm with config `%s' on host `%s'.\n", | 974 | "Starting gnunet-arm with config `%s' on host `%s'.\n", |
1027 | d->cfgfile, d->hostname); | 975 | d->cfgfile, d->hostname); |
1028 | #endif | ||
1029 | |||
1030 | if (d->username != NULL) | 976 | if (d->username != NULL) |
1031 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 977 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1032 | else | 978 | else |
1033 | arg = GNUNET_strdup (d->hostname); | 979 | arg = GNUNET_strdup (d->hostname); |
1034 | 980 | ||
1035 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 981 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1036 | #if !DEBUG_TESTING | 982 | #if !DEBUG_TESTING |
1037 | "-q", | 983 | "-q", |
1038 | #endif | 984 | #endif |
@@ -1052,11 +998,9 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | |||
1052 | } | 998 | } |
1053 | else | 999 | else |
1054 | { | 1000 | { |
1055 | #if DEBUG_TESTING | ||
1056 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1001 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1057 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1002 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1058 | #endif | 1003 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1059 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1060 | #if DEBUG_TESTING | 1004 | #if DEBUG_TESTING |
1061 | "-L", "DEBUG", | 1005 | "-L", "DEBUG", |
1062 | #endif | 1006 | #endif |
@@ -1169,10 +1113,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1169 | GNUNET_asprintf (&temp_file_name, "%s/gnunet-testing-config", servicehome); | 1113 | GNUNET_asprintf (&temp_file_name, "%s/gnunet-testing-config", servicehome); |
1170 | ret->cfgfile = GNUNET_DISK_mktemp (temp_file_name); | 1114 | ret->cfgfile = GNUNET_DISK_mktemp (temp_file_name); |
1171 | GNUNET_free (temp_file_name); | 1115 | GNUNET_free (temp_file_name); |
1172 | #if DEBUG_TESTING | ||
1173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1116 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1174 | "Setting up peer with configuration file `%s'.\n", ret->cfgfile); | 1117 | "Setting up peer with configuration file `%s'.\n", ret->cfgfile); |
1175 | #endif | ||
1176 | if (NULL == ret->cfgfile) | 1118 | if (NULL == ret->cfgfile) |
1177 | { | 1119 | { |
1178 | GNUNET_free_non_null (ret->ssh_port_str); | 1120 | GNUNET_free_non_null (ret->ssh_port_str); |
@@ -1249,10 +1191,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1249 | /* copy directory to remote host */ | 1191 | /* copy directory to remote host */ |
1250 | if (NULL != hostname) | 1192 | if (NULL != hostname) |
1251 | { | 1193 | { |
1252 | #if DEBUG_TESTING | ||
1253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1254 | "Copying configuration directory to host `%s'.\n", hostname); | 1195 | "Copying configuration directory to host `%s'.\n", hostname); |
1255 | #endif | ||
1256 | baseservicehome = GNUNET_strdup (servicehome); | 1196 | baseservicehome = GNUNET_strdup (servicehome); |
1257 | /* Remove trailing /'s */ | 1197 | /* Remove trailing /'s */ |
1258 | while (baseservicehome[strlen (baseservicehome) - 1] == '/') | 1198 | while (baseservicehome[strlen (baseservicehome) - 1] == '/') |
@@ -1270,21 +1210,19 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1270 | GNUNET_free (baseservicehome); | 1210 | GNUNET_free (baseservicehome); |
1271 | if (ret->ssh_port_str == NULL) | 1211 | if (ret->ssh_port_str == NULL) |
1272 | { | 1212 | { |
1273 | ret->proc = GNUNET_OS_start_process (NULL, NULL, "scp", "scp", "-r", | 1213 | ret->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", |
1274 | #if !DEBUG_TESTING | 1214 | #if !DEBUG_TESTING |
1275 | "-q", | 1215 | "-q", |
1276 | #endif | 1216 | #endif |
1277 | servicehome, arg, NULL); | 1217 | servicehome, arg, NULL); |
1278 | #if DEBUG_TESTING | ||
1279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1280 | "copying directory with command scp -r %s %s\n", | 1219 | "copying directory with command scp -r %s %s\n", |
1281 | servicehome, arg); | 1220 | servicehome, arg); |
1282 | #endif | ||
1283 | } | 1221 | } |
1284 | else | 1222 | else |
1285 | { | 1223 | { |
1286 | ret->proc = | 1224 | ret->proc = |
1287 | GNUNET_OS_start_process (NULL, NULL, "scp", "scp", "-r", "-P", | 1225 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", "-P", |
1288 | ret->ssh_port_str, | 1226 | ret->ssh_port_str, |
1289 | #if !DEBUG_TESTING | 1227 | #if !DEBUG_TESTING |
1290 | "-q", | 1228 | "-q", |
@@ -1322,10 +1260,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1322 | GNUNET_free (servicehome); | 1260 | GNUNET_free (servicehome); |
1323 | return ret; | 1261 | return ret; |
1324 | } | 1262 | } |
1325 | #if DEBUG_TESTING | ||
1326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1263 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1327 | "No need to copy configuration file since we are running locally.\n"); | 1264 | "No need to copy configuration file since we are running locally.\n"); |
1328 | #endif | ||
1329 | ret->phase = SP_COPIED; | 1265 | ret->phase = SP_COPIED; |
1330 | /* FIXME: why add_cont? */ | 1266 | /* FIXME: why add_cont? */ |
1331 | GNUNET_SCHEDULER_add_continuation (&start_fsm, ret, | 1267 | GNUNET_SCHEDULER_add_continuation (&start_fsm, ret, |
@@ -1383,28 +1319,22 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
1383 | /* state clean up and notifications */ | 1319 | /* state clean up and notifications */ |
1384 | GNUNET_free_non_null (d->hello); | 1320 | GNUNET_free_non_null (d->hello); |
1385 | 1321 | ||
1386 | #if DEBUG_TESTING | ||
1387 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), | 1322 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), |
1388 | GNUNET_i2s (&d->id)); | 1323 | GNUNET_i2s (&d->id)); |
1389 | #endif | ||
1390 | |||
1391 | d->phase = SP_START_ARMING; | 1324 | d->phase = SP_START_ARMING; |
1392 | 1325 | ||
1393 | /* Check if this is a local or remote process */ | 1326 | /* Check if this is a local or remote process */ |
1394 | if (NULL != d->hostname) | 1327 | if (NULL != d->hostname) |
1395 | { | 1328 | { |
1396 | #if DEBUG_TESTING | ||
1397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1329 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1398 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", | 1330 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", |
1399 | d->cfgfile, d->hostname); | 1331 | d->cfgfile, d->hostname); |
1400 | #endif | ||
1401 | |||
1402 | if (d->username != NULL) | 1332 | if (d->username != NULL) |
1403 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 1333 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1404 | else | 1334 | else |
1405 | arg = GNUNET_strdup (d->hostname); | 1335 | arg = GNUNET_strdup (d->hostname); |
1406 | 1336 | ||
1407 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 1337 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1408 | #if !DEBUG_TESTING | 1338 | #if !DEBUG_TESTING |
1409 | "-q", | 1339 | "-q", |
1410 | #endif | 1340 | #endif |
@@ -1419,11 +1349,9 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
1419 | } | 1349 | } |
1420 | else | 1350 | else |
1421 | { | 1351 | { |
1422 | #if DEBUG_TESTING | ||
1423 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1424 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1353 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1425 | #endif | 1354 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1426 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1427 | #if DEBUG_TESTING | 1355 | #if DEBUG_TESTING |
1428 | "-L", "DEBUG", | 1356 | "-L", "DEBUG", |
1429 | #endif | 1357 | #endif |
@@ -1466,10 +1394,8 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
1466 | d->phase = SP_START_DONE; | 1394 | d->phase = SP_START_DONE; |
1467 | } | 1395 | } |
1468 | 1396 | ||
1469 | #if DEBUG_TESTING | ||
1470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), | 1397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), |
1471 | GNUNET_i2s (&d->id)); | 1398 | GNUNET_i2s (&d->id)); |
1472 | #endif | ||
1473 | if (d->churned_services != NULL) | 1399 | if (d->churned_services != NULL) |
1474 | { | 1400 | { |
1475 | d->dead_cb (d->dead_cb_cls, "A service has already been turned off!!"); | 1401 | d->dead_cb (d->dead_cb_cls, "A service has already been turned off!!"); |
@@ -1481,18 +1407,15 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
1481 | /* Check if this is a local or remote process */ | 1407 | /* Check if this is a local or remote process */ |
1482 | if (NULL != d->hostname) | 1408 | if (NULL != d->hostname) |
1483 | { | 1409 | { |
1484 | #if DEBUG_TESTING | ||
1485 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1486 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", | 1411 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", |
1487 | d->cfgfile, d->hostname); | 1412 | d->cfgfile, d->hostname); |
1488 | #endif | ||
1489 | |||
1490 | if (d->username != NULL) | 1413 | if (d->username != NULL) |
1491 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 1414 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1492 | else | 1415 | else |
1493 | arg = GNUNET_strdup (d->hostname); | 1416 | arg = GNUNET_strdup (d->hostname); |
1494 | 1417 | ||
1495 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 1418 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1496 | #if !DEBUG_TESTING | 1419 | #if !DEBUG_TESTING |
1497 | "-q", | 1420 | "-q", |
1498 | #endif | 1421 | #endif |
@@ -1511,11 +1434,9 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
1511 | } | 1434 | } |
1512 | else | 1435 | else |
1513 | { | 1436 | { |
1514 | #if DEBUG_TESTING | ||
1515 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1437 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1516 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1438 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1517 | #endif | 1439 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1518 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1519 | #if DEBUG_TESTING | 1440 | #if DEBUG_TESTING |
1520 | "-L", "DEBUG", | 1441 | "-L", "DEBUG", |
1521 | #endif | 1442 | #endif |
@@ -1556,10 +1477,8 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1556 | 1477 | ||
1557 | if (NULL != d->cb) | 1478 | if (NULL != d->cb) |
1558 | { | 1479 | { |
1559 | #if DEBUG_TESTING | ||
1560 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Setting d->dead on peer `%4s'\n"), | 1480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Setting d->dead on peer `%4s'\n"), |
1561 | GNUNET_i2s (&d->id)); | 1481 | GNUNET_i2s (&d->id)); |
1562 | #endif | ||
1563 | d->dead = GNUNET_YES; | 1482 | d->dead = GNUNET_YES; |
1564 | return; | 1483 | return; |
1565 | } | 1484 | } |
@@ -1604,10 +1523,8 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1604 | } | 1523 | } |
1605 | */ | 1524 | */ |
1606 | /* shutdown ARM process (will terminate others) */ | 1525 | /* shutdown ARM process (will terminate others) */ |
1607 | #if DEBUG_TESTING | 1526 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Terminating peer `%4s'\n" , |
1608 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), | ||
1609 | GNUNET_i2s (&d->id)); | 1527 | GNUNET_i2s (&d->id)); |
1610 | #endif | ||
1611 | d->phase = SP_SHUTDOWN_START; | 1528 | d->phase = SP_SHUTDOWN_START; |
1612 | d->running = GNUNET_NO; | 1529 | d->running = GNUNET_NO; |
1613 | if (allow_restart == GNUNET_YES) | 1530 | if (allow_restart == GNUNET_YES) |
@@ -1622,18 +1539,15 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1622 | /* Check if this is a local or remote process */ | 1539 | /* Check if this is a local or remote process */ |
1623 | if (NULL != d->hostname) | 1540 | if (NULL != d->hostname) |
1624 | { | 1541 | { |
1625 | #if DEBUG_TESTING | ||
1626 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1542 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1627 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", | 1543 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", |
1628 | d->cfgfile, d->hostname); | 1544 | d->cfgfile, d->hostname); |
1629 | #endif | ||
1630 | |||
1631 | if (d->username != NULL) | 1545 | if (d->username != NULL) |
1632 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 1546 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1633 | else | 1547 | else |
1634 | arg = GNUNET_strdup (d->hostname); | 1548 | arg = GNUNET_strdup (d->hostname); |
1635 | 1549 | ||
1636 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 1550 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1637 | #if !DEBUG_TESTING | 1551 | #if !DEBUG_TESTING |
1638 | "-q", | 1552 | "-q", |
1639 | #endif | 1553 | #endif |
@@ -1652,11 +1566,9 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1652 | } | 1566 | } |
1653 | else | 1567 | else |
1654 | { | 1568 | { |
1655 | #if DEBUG_TESTING | ||
1656 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1569 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1657 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1570 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1658 | #endif | 1571 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1659 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1660 | #if DEBUG_TESTING | 1572 | #if DEBUG_TESTING |
1661 | "-L", "DEBUG", | 1573 | "-L", "DEBUG", |
1662 | #endif | 1574 | #endif |
@@ -1715,17 +1627,15 @@ GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, | |||
1715 | cb (cb_cls, NULL); | 1627 | cb (cb_cls, NULL); |
1716 | return; | 1628 | return; |
1717 | } | 1629 | } |
1718 | #if DEBUG_TESTING | ||
1719 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1630 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1720 | "Copying updated configuration file to remote host `%s'.\n", | 1631 | "Copying updated configuration file to remote host `%s'.\n", |
1721 | d->hostname); | 1632 | d->hostname); |
1722 | #endif | ||
1723 | d->phase = SP_CONFIG_UPDATE; | 1633 | d->phase = SP_CONFIG_UPDATE; |
1724 | if (NULL != d->username) | 1634 | if (NULL != d->username) |
1725 | GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile); | 1635 | GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile); |
1726 | else | 1636 | else |
1727 | GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile); | 1637 | GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile); |
1728 | d->proc = GNUNET_OS_start_process (NULL, NULL, "scp", "scp", | 1638 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", |
1729 | #if !DEBUG_TESTING | 1639 | #if !DEBUG_TESTING |
1730 | "-q", | 1640 | "-q", |
1731 | #endif | 1641 | #endif |
@@ -1915,11 +1825,8 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1915 | { | 1825 | { |
1916 | struct GNUNET_TESTING_ConnectContext *ctx = cls; | 1826 | struct GNUNET_TESTING_ConnectContext *ctx = cls; |
1917 | 1827 | ||
1918 | #if DEBUG_TESTING | ||
1919 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected peer %s to peer %s\n", | 1828 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected peer %s to peer %s\n", |
1920 | ctx->d1->shortname, GNUNET_i2s (peer)); | 1829 | ctx->d1->shortname, GNUNET_i2s (peer)); |
1921 | #endif | ||
1922 | |||
1923 | if (0 != memcmp (&ctx->d2->id, peer, sizeof (struct GNUNET_PeerIdentity))) | 1830 | if (0 != memcmp (&ctx->d2->id, peer, sizeof (struct GNUNET_PeerIdentity))) |
1924 | return; | 1831 | return; |
1925 | ctx->connected = GNUNET_YES; | 1832 | ctx->connected = GNUNET_YES; |
@@ -1949,18 +1856,14 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1949 | { | 1856 | { |
1950 | hello = GNUNET_HELLO_get_header (ctx->d2->hello); | 1857 | hello = GNUNET_HELLO_get_header (ctx->d2->hello); |
1951 | GNUNET_assert (hello != NULL); | 1858 | GNUNET_assert (hello != NULL); |
1952 | #if DEBUG_TESTING | ||
1953 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Offering hello of %s to %s\n", | 1859 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Offering hello of %s to %s\n", |
1954 | ctx->d2->shortname, ctx->d1->shortname); | 1860 | ctx->d2->shortname, ctx->d1->shortname); |
1955 | #endif | ||
1956 | GNUNET_TRANSPORT_offer_hello (ctx->d1th, hello, NULL, NULL); | 1861 | GNUNET_TRANSPORT_offer_hello (ctx->d1th, hello, NULL, NULL); |
1957 | GNUNET_assert (ctx->d1core != NULL); | 1862 | GNUNET_assert (ctx->d1core != NULL); |
1958 | #if DEBUG_TESTING | ||
1959 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1863 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1960 | "Sending connect request to TRANSPORT of %s for peer %s\n", | 1864 | "Sending connect request to TRANSPORT of %s for peer %s\n", |
1961 | GNUNET_i2s (&ctx->d1->id), | 1865 | GNUNET_i2s (&ctx->d1->id), |
1962 | GNUNET_h2s (&ctx->d2->id.hashPubKey)); | 1866 | GNUNET_h2s (&ctx->d2->id.hashPubKey)); |
1963 | #endif | ||
1964 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); | 1867 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); |
1965 | ctx->timeout_hello = | 1868 | ctx->timeout_hello = |
1966 | GNUNET_TIME_relative_add (ctx->timeout_hello, | 1869 | GNUNET_TIME_relative_add (ctx->timeout_hello, |
@@ -1989,13 +1892,10 @@ core_init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
1989 | if (connect_ctx->send_hello == GNUNET_NO) | 1892 | if (connect_ctx->send_hello == GNUNET_NO) |
1990 | { | 1893 | { |
1991 | GNUNET_TRANSPORT_try_connect (connect_ctx->d1th, &connect_ctx->d2->id); | 1894 | GNUNET_TRANSPORT_try_connect (connect_ctx->d1th, &connect_ctx->d2->id); |
1992 | #if DEBUG_TESTING | ||
1993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1895 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1994 | "Sending connect request to TRANSPORT of %s for peer %s\n", | 1896 | "Sending connect request to TRANSPORT of %s for peer %s\n", |
1995 | connect_ctx->d1->shortname, connect_ctx->d2->shortname); | 1897 | connect_ctx->d1->shortname, connect_ctx->d2->shortname); |
1996 | #endif | ||
1997 | } | 1898 | } |
1998 | |||
1999 | } | 1899 | } |
2000 | 1900 | ||
2001 | 1901 | ||
@@ -2015,11 +1915,9 @@ reattempt_daemons_connect (void *cls, | |||
2015 | ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1915 | ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
2016 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 1916 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
2017 | return; | 1917 | return; |
2018 | #if DEBUG_TESTING_RECONNECT | ||
2019 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1918 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2020 | "re-attempting connect of peer %s to peer %s\n", | 1919 | "re-attempting connect of peer %s to peer %s\n", |
2021 | ctx->d1->shortname, ctx->d2->shortname); | 1920 | ctx->d1->shortname, ctx->d2->shortname); |
2022 | #endif | ||
2023 | ctx->connect_attempts--; | 1921 | ctx->connect_attempts--; |
2024 | GNUNET_assert (ctx->d1core == NULL); | 1922 | GNUNET_assert (ctx->d1core == NULL); |
2025 | ctx->d1core_ready = GNUNET_NO; | 1923 | ctx->d1core_ready = GNUNET_NO; |
@@ -2040,10 +1938,8 @@ reattempt_daemons_connect (void *cls, | |||
2040 | /* Don't know reason for initial connect failure, update the HELLO for the second peer */ | 1938 | /* Don't know reason for initial connect failure, update the HELLO for the second peer */ |
2041 | if (NULL != ctx->d2->hello) | 1939 | if (NULL != ctx->d2->hello) |
2042 | { | 1940 | { |
2043 | #if DEBUG_TESTING_RECONNECT | ||
2044 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "updating %s's HELLO\n", | 1941 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "updating %s's HELLO\n", |
2045 | ctx->d2->shortname); | 1942 | ctx->d2->shortname); |
2046 | #endif | ||
2047 | GNUNET_free (ctx->d2->hello); | 1943 | GNUNET_free (ctx->d2->hello); |
2048 | ctx->d2->hello = NULL; | 1944 | ctx->d2->hello = NULL; |
2049 | if (NULL != ctx->d2->th) | 1945 | if (NULL != ctx->d2->th) |
@@ -2059,21 +1955,17 @@ reattempt_daemons_connect (void *cls, | |||
2059 | ctx->d2->ghh = | 1955 | ctx->d2->ghh = |
2060 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 1956 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); |
2061 | } | 1957 | } |
2062 | #if DEBUG_TESTING_RECONNECT | ||
2063 | else | 1958 | else |
2064 | { | 1959 | { |
2065 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "didn't have %s's HELLO\n", | 1960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "didn't have %s's HELLO\n", |
2066 | ctx->d2->shortname); | 1961 | ctx->d2->shortname); |
2067 | } | 1962 | } |
2068 | #endif | ||
2069 | 1963 | ||
2070 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) | 1964 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) |
2071 | { | 1965 | { |
2072 | #if DEBUG_TESTING_RECONNECT | ||
2073 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1966 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2074 | "didn't have %s's HELLO, trying to get it now\n", | 1967 | "didn't have %s's HELLO, trying to get it now\n", |
2075 | ctx->d2->shortname); | 1968 | ctx->d2->shortname); |
2076 | #endif | ||
2077 | ctx->d2->th = | 1969 | ctx->d2->th = |
2078 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, | 1970 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, |
2079 | NULL); | 1971 | NULL); |
@@ -2090,7 +1982,6 @@ reattempt_daemons_connect (void *cls, | |||
2090 | ctx->d2->ghh = | 1982 | ctx->d2->ghh = |
2091 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 1983 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); |
2092 | } | 1984 | } |
2093 | #if DEBUG_TESTING_RECONNECT | ||
2094 | else | 1985 | else |
2095 | { | 1986 | { |
2096 | if (NULL == ctx->d2->hello) | 1987 | if (NULL == ctx->d2->hello) |
@@ -2100,14 +1991,11 @@ reattempt_daemons_connect (void *cls, | |||
2100 | ctx->d2->shortname); | 1991 | ctx->d2->shortname); |
2101 | } | 1992 | } |
2102 | } | 1993 | } |
2103 | #endif | ||
2104 | 1994 | ||
2105 | if (ctx->send_hello == GNUNET_YES) | 1995 | if (ctx->send_hello == GNUNET_YES) |
2106 | { | 1996 | { |
2107 | #if DEBUG_TESTING_RECONNECT | ||
2108 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %s's HELLO to %s\n", | 1997 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %s's HELLO to %s\n", |
2109 | ctx->d1->shortname, ctx->d2->shortname); | 1998 | ctx->d1->shortname, ctx->d2->shortname); |
2110 | #endif | ||
2111 | ctx->d1th = | 1999 | ctx->d1th = |
2112 | GNUNET_TRANSPORT_connect (ctx->d1->cfg, &ctx->d1->id, ctx->d1, NULL, | 2000 | GNUNET_TRANSPORT_connect (ctx->d1->cfg, &ctx->d1->id, ctx->d1, NULL, |
2113 | NULL, NULL); | 2001 | NULL, NULL); |
@@ -2126,10 +2014,8 @@ reattempt_daemons_connect (void *cls, | |||
2126 | } | 2014 | } |
2127 | else | 2015 | else |
2128 | { | 2016 | { |
2129 | #if DEBUG_TESTING_RECONNECT | ||
2130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to reconnect %s to %s\n", | 2017 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to reconnect %s to %s\n", |
2131 | ctx->d1->shortname, ctx->d2->shortname); | 2018 | ctx->d1->shortname, ctx->d2->shortname); |
2132 | #endif | ||
2133 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); | 2019 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); |
2134 | } | 2020 | } |
2135 | ctx->timeout_task = | 2021 | ctx->timeout_task = |
@@ -2177,10 +2063,8 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2177 | /* Peer not already connected, need to schedule connect request! */ | 2063 | /* Peer not already connected, need to schedule connect request! */ |
2178 | if (ctx->d1core == NULL) | 2064 | if (ctx->d1core == NULL) |
2179 | { | 2065 | { |
2180 | #if DEBUG_TESTING | ||
2181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2066 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2182 | "Peers are NOT connected, connecting to core!\n"); | 2067 | "Peers are NOT connected, connecting to core!\n"); |
2183 | #endif | ||
2184 | ctx->d1core = | 2068 | ctx->d1core = |
2185 | GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, | 2069 | GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, |
2186 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, | 2070 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, |
@@ -2195,10 +2079,8 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2195 | 2079 | ||
2196 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) /* Do not yet have the second peer's hello, set up a task to get it */ | 2080 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) /* Do not yet have the second peer's hello, set up a task to get it */ |
2197 | { | 2081 | { |
2198 | #if DEBUG_TESTING | ||
2199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2082 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2200 | "Don't have d2's HELLO, trying to get it!\n"); | 2083 | "Don't have d2's HELLO, trying to get it!\n"); |
2201 | #endif | ||
2202 | ctx->d2->th = | 2084 | ctx->d2->th = |
2203 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, | 2085 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, |
2204 | NULL); | 2086 | NULL); |
@@ -2288,11 +2170,8 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
2288 | ctx->connect_attempts = max_connect_attempts; | 2170 | ctx->connect_attempts = max_connect_attempts; |
2289 | ctx->connected = GNUNET_NO; | 2171 | ctx->connected = GNUNET_NO; |
2290 | ctx->send_hello = send_hello; | 2172 | ctx->send_hello = send_hello; |
2291 | #if DEBUG_TESTING | ||
2292 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to connect peer %s to peer %s\n", | 2173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to connect peer %s to peer %s\n", |
2293 | d1->shortname, d2->shortname); | 2174 | d1->shortname, d2->shortname); |
2294 | #endif | ||
2295 | |||
2296 | /* Core is up! Iterate over all _known_ peers first to check if we are already connected to the peer! */ | 2175 | /* Core is up! Iterate over all _known_ peers first to check if we are already connected to the peer! */ |
2297 | GNUNET_assert (GNUNET_OK == | 2176 | GNUNET_assert (GNUNET_OK == |
2298 | GNUNET_CORE_is_peer_connected (ctx->d1->cfg, &ctx->d2->id, | 2177 | GNUNET_CORE_is_peer_connected (ctx->d1->cfg, &ctx->d2->id, |