diff options
Diffstat (limited to 'src/arm/gnunet-service-arm.c')
-rw-r--r-- | src/arm/gnunet-service-arm.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index ab4db97c7..c967c64e6 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -124,11 +124,6 @@ static struct ServiceList *running; | |||
124 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 124 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Our scheduler. | ||
128 | */ | ||
129 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
130 | |||
131 | /** | ||
132 | * Command to prepend to each actual command. | 127 | * Command to prepend to each actual command. |
133 | */ | 128 | */ |
134 | static char *prefix_command; | 129 | static char *prefix_command; |
@@ -695,7 +690,7 @@ do_shutdown () | |||
695 | { | 690 | { |
696 | GNUNET_SERVER_destroy (server); | 691 | GNUNET_SERVER_destroy (server); |
697 | server = NULL; | 692 | server = NULL; |
698 | GNUNET_SCHEDULER_cancel (sched, child_death_task); | 693 | GNUNET_SCHEDULER_cancel (child_death_task); |
699 | child_death_task = GNUNET_SCHEDULER_NO_TASK; | 694 | child_death_task = GNUNET_SCHEDULER_NO_TASK; |
700 | } | 695 | } |
701 | 696 | ||
@@ -741,7 +736,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
741 | pos = pos->next; | 736 | pos = pos->next; |
742 | } | 737 | } |
743 | #if DELAY_SHUTDOWN | 738 | #if DELAY_SHUTDOWN |
744 | GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2), &dummy_task, NULL); | 739 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2), &dummy_task, NULL); |
745 | #endif | 740 | #endif |
746 | if (running == NULL) | 741 | if (running == NULL) |
747 | do_shutdown (); | 742 | do_shutdown (); |
@@ -802,8 +797,7 @@ delayed_restart_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
802 | (unsigned long long) lowestRestartDelay.rel_value); | 797 | (unsigned long long) lowestRestartDelay.rel_value); |
803 | #endif | 798 | #endif |
804 | child_restart_task | 799 | child_restart_task |
805 | = GNUNET_SCHEDULER_add_delayed (sched, | 800 | = GNUNET_SCHEDULER_add_delayed (lowestRestartDelay, |
806 | lowestRestartDelay, | ||
807 | &delayed_restart_task, | 801 | &delayed_restart_task, |
808 | NULL); | 802 | NULL); |
809 | } | 803 | } |
@@ -834,7 +828,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
834 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) | 828 | if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) |
835 | { | 829 | { |
836 | child_death_task = | 830 | child_death_task = |
837 | GNUNET_SCHEDULER_add_read_file (sched, GNUNET_TIME_UNIT_FOREVER_REL, pr, | 831 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, pr, |
838 | &maint_child_death, NULL); | 832 | &maint_child_death, NULL); |
839 | return; | 833 | return; |
840 | } | 834 | } |
@@ -909,10 +903,9 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
909 | pos->backoff | 903 | pos->backoff |
910 | = GNUNET_TIME_relative_multiply (pos->backoff, 2); | 904 | = GNUNET_TIME_relative_multiply (pos->backoff, 2); |
911 | if (GNUNET_SCHEDULER_NO_TASK != child_restart_task) | 905 | if (GNUNET_SCHEDULER_NO_TASK != child_restart_task) |
912 | GNUNET_SCHEDULER_cancel (sched, child_restart_task); | 906 | GNUNET_SCHEDULER_cancel (child_restart_task); |
913 | child_restart_task | 907 | child_restart_task |
914 | = GNUNET_SCHEDULER_add_with_priority (sched, | 908 | = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, |
915 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
916 | &delayed_restart_task, | 909 | &delayed_restart_task, |
917 | NULL); | 910 | NULL); |
918 | } | 911 | } |
@@ -934,7 +927,7 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
934 | else | 927 | else |
935 | { | 928 | { |
936 | child_death_task = | 929 | child_death_task = |
937 | GNUNET_SCHEDULER_add_read_file (sched, GNUNET_TIME_UNIT_FOREVER_REL, pr, | 930 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, pr, |
938 | &maint_child_death, NULL); | 931 | &maint_child_death, NULL); |
939 | } | 932 | } |
940 | } | 933 | } |
@@ -986,7 +979,7 @@ handle_shutdown (void *cls, | |||
986 | GNUNET_TIME_UNIT_FOREVER_REL, | 979 | GNUNET_TIME_UNIT_FOREVER_REL, |
987 | &transmit_shutdown_ack, client); | 980 | &transmit_shutdown_ack, client); |
988 | GNUNET_SERVER_client_persist_ (client); | 981 | GNUNET_SERVER_client_persist_ (client); |
989 | GNUNET_SCHEDULER_shutdown (sched); | 982 | GNUNET_SCHEDULER_shutdown (); |
990 | } | 983 | } |
991 | 984 | ||
992 | 985 | ||
@@ -1011,13 +1004,11 @@ sighandler_child_death () | |||
1011 | * Process arm requests. | 1004 | * Process arm requests. |
1012 | * | 1005 | * |
1013 | * @param cls closure | 1006 | * @param cls closure |
1014 | * @param s scheduler to use | ||
1015 | * @param serv the initialized server | 1007 | * @param serv the initialized server |
1016 | * @param c configuration to use | 1008 | * @param c configuration to use |
1017 | */ | 1009 | */ |
1018 | static void | 1010 | static void |
1019 | run (void *cls, | 1011 | run (void *cls, |
1020 | struct GNUNET_SCHEDULER_Handle *s, | ||
1021 | struct GNUNET_SERVER_Handle *serv, | 1012 | struct GNUNET_SERVER_Handle *serv, |
1022 | const struct GNUNET_CONFIGURATION_Handle *c) | 1013 | const struct GNUNET_CONFIGURATION_Handle *c) |
1023 | { | 1014 | { |
@@ -1032,18 +1023,16 @@ run (void *cls, | |||
1032 | char *pos; | 1023 | char *pos; |
1033 | 1024 | ||
1034 | cfg = c; | 1025 | cfg = c; |
1035 | sched = s; | ||
1036 | server = serv; | 1026 | server = serv; |
1037 | GNUNET_assert (serv != NULL); | 1027 | GNUNET_assert (serv != NULL); |
1038 | pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); | 1028 | pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ); |
1039 | GNUNET_assert (pr != NULL); | 1029 | GNUNET_assert (pr != NULL); |
1040 | GNUNET_SERVER_ignore_shutdown (serv, GNUNET_YES); | 1030 | GNUNET_SERVER_ignore_shutdown (serv, GNUNET_YES); |
1041 | GNUNET_SCHEDULER_add_delayed (sched, | 1031 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
1042 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1043 | &shutdown_task, | 1032 | &shutdown_task, |
1044 | NULL); | 1033 | NULL); |
1045 | child_death_task = | 1034 | child_death_task = |
1046 | GNUNET_SCHEDULER_add_read_file (sched, GNUNET_TIME_UNIT_FOREVER_REL, pr, | 1035 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, pr, |
1047 | &maint_child_death, NULL); | 1036 | &maint_child_death, NULL); |
1048 | 1037 | ||
1049 | if (GNUNET_OK != | 1038 | if (GNUNET_OK != |
@@ -1089,14 +1078,13 @@ run (void *cls, | |||
1089 | } | 1078 | } |
1090 | 1079 | ||
1091 | /* create listening sockets for future services*/ | 1080 | /* create listening sockets for future services*/ |
1092 | prepareServices (cfg, sched); | 1081 | prepareServices (cfg); |
1093 | 1082 | ||
1094 | /* process client requests */ | 1083 | /* process client requests */ |
1095 | GNUNET_SERVER_add_handlers (server, handlers); | 1084 | GNUNET_SERVER_add_handlers (server, handlers); |
1096 | 1085 | ||
1097 | /* manage services */ | 1086 | /* manage services */ |
1098 | GNUNET_SCHEDULER_add_with_priority (sched, | 1087 | GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, |
1099 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
1100 | &config_change_task, NULL); | 1088 | &config_change_task, NULL); |
1101 | } | 1089 | } |
1102 | 1090 | ||