diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-07-09 11:23:49 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-07-09 11:23:49 +0000 |
commit | 0890551ed766641630b318db14f86a11802702bb (patch) | |
tree | de0e0bbc7bd791c5f6913506687a6ce7d2e78ca3 /src/transport/gnunet-transport.c | |
parent | 8bdc9a4b52d7b36c2beacdf645a64d4f200ec280 (diff) | |
download | gnunet-0890551ed766641630b318db14f86a11802702bb.tar.gz gnunet-0890551ed766641630b318db14f86a11802702bb.zip |
- check if service is running
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r-- | src/transport/gnunet-transport.c | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index c727a6fec..42b7f6062 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -607,24 +607,18 @@ shutdown_task (void *cls, | |||
607 | } | 607 | } |
608 | } | 608 | } |
609 | 609 | ||
610 | |||
611 | |||
612 | /** | ||
613 | * Main function that will be run by the scheduler. | ||
614 | * | ||
615 | * @param cls closure | ||
616 | * @param args remaining command-line arguments | ||
617 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
618 | * @param cfg configuration | ||
619 | */ | ||
620 | static void | 610 | static void |
621 | run (void *cls, char *const *args, const char *cfgfile, | 611 | testservice_task (void *cls, |
622 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 612 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
623 | { | 613 | { |
624 | if (test_configuration) | 614 | struct GNUNET_CONFIGURATION_Handle *cfg = cls; |
615 | |||
616 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) | ||
625 | { | 617 | { |
626 | do_test_configuration (cfg); | 618 | FPRINTF (stderr, _("Service `%s' is not running\n"), "transport"); |
619 | return; | ||
627 | } | 620 | } |
621 | |||
628 | if (benchmark_send && (NULL == cpid)) | 622 | if (benchmark_send && (NULL == cpid)) |
629 | { | 623 | { |
630 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), | 624 | FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), |
@@ -684,6 +678,32 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
684 | NULL); | 678 | NULL); |
685 | } | 679 | } |
686 | } | 680 | } |
681 | |||
682 | |||
683 | } | ||
684 | |||
685 | |||
686 | /** | ||
687 | * Main function that will be run by the scheduler. | ||
688 | * | ||
689 | * @param cls closure | ||
690 | * @param args remaining command-line arguments | ||
691 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
692 | * @param cfg configuration | ||
693 | */ | ||
694 | static void | ||
695 | run (void *cls, char *const *args, const char *cfgfile, | ||
696 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
697 | { | ||
698 | if (test_configuration) | ||
699 | { | ||
700 | do_test_configuration (cfg); | ||
701 | } | ||
702 | |||
703 | GNUNET_CLIENT_service_test ("transport", cfg, | ||
704 | GNUNET_TIME_UNIT_SECONDS, | ||
705 | &testservice_task, | ||
706 | (void *) cfg); | ||
687 | } | 707 | } |
688 | 708 | ||
689 | 709 | ||