diff options
author | xrs <xrs@mail36.net> | 2018-06-23 16:58:42 +0200 |
---|---|---|
committer | xrs <xrs@mail36.net> | 2018-06-23 16:58:42 +0200 |
commit | 99c6e18e63181d8759ecbb398d58019a55d3ce6f (patch) | |
tree | cf925bf99a6fbe60dbec8ead7248bc59a0c8cce6 /src/arm/gnunet-service-arm.c | |
parent | b993ca621717d0a9958b4138a32fb1e3cef7f54c (diff) | |
parent | c293f84ea192f361baf720a3979589c0e0881abc (diff) | |
download | gnunet-99c6e18e63181d8759ecbb398d58019a55d3ce6f.tar.gz gnunet-99c6e18e63181d8759ecbb398d58019a55d3ce6f.zip |
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src/arm/gnunet-service-arm.c')
-rw-r--r-- | src/arm/gnunet-service-arm.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index b56c9c0a8..a6dccf3de 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -235,6 +235,11 @@ static struct GNUNET_DISK_PipeHandle *sigpipe; | |||
235 | static int in_shutdown; | 235 | static int in_shutdown; |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Return value from main | ||
239 | */ | ||
240 | static int global_ret; | ||
241 | |||
242 | /** | ||
238 | * Are we starting user services? | 243 | * Are we starting user services? |
239 | */ | 244 | */ |
240 | static int start_user = GNUNET_YES; | 245 | static int start_user = GNUNET_YES; |
@@ -505,7 +510,7 @@ get_server_addresses (const char *service_name, | |||
505 | if (GNUNET_YES == | 510 | if (GNUNET_YES == |
506 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | 511 | GNUNET_CONFIGURATION_get_value_yesno (cfg, |
507 | service_name, | 512 | service_name, |
508 | "AUTOSTART")) | 513 | "START_ON_DEMAND")) |
509 | LOG (GNUNET_ERROR_TYPE_ERROR, | 514 | LOG (GNUNET_ERROR_TYPE_ERROR, |
510 | _("Have neither PORT nor UNIXPATH for service `%s', but one is required\n"), | 515 | _("Have neither PORT nor UNIXPATH for service `%s', but one is required\n"), |
511 | service_name); | 516 | service_name); |
@@ -1985,11 +1990,11 @@ setup_service (void *cls, | |||
1985 | if ((GNUNET_YES == | 1990 | if ((GNUNET_YES == |
1986 | GNUNET_CONFIGURATION_have_value (cfg, | 1991 | GNUNET_CONFIGURATION_have_value (cfg, |
1987 | section, | 1992 | section, |
1988 | "USER_SERVICE")) && | 1993 | "RUN_PER_USER")) && |
1989 | (GNUNET_YES == | 1994 | (GNUNET_YES == |
1990 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | 1995 | GNUNET_CONFIGURATION_get_value_yesno (cfg, |
1991 | section, | 1996 | section, |
1992 | "USER_SERVICE"))) | 1997 | "RUN_PER_USER"))) |
1993 | { | 1998 | { |
1994 | if (GNUNET_NO == start_user) | 1999 | if (GNUNET_NO == start_user) |
1995 | { | 2000 | { |
@@ -2071,7 +2076,7 @@ setup_service (void *cls, | |||
2071 | if (GNUNET_YES != | 2076 | if (GNUNET_YES != |
2072 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | 2077 | GNUNET_CONFIGURATION_get_value_yesno (cfg, |
2073 | section, | 2078 | section, |
2074 | "AUTOSTART")) | 2079 | "START_ON_DEMAND")) |
2075 | return; | 2080 | return; |
2076 | } | 2081 | } |
2077 | if (0 >= (ret = get_server_addresses (section, | 2082 | if (0 >= (ret = get_server_addresses (section, |
@@ -2219,21 +2224,20 @@ run (void *cls, | |||
2219 | else | 2224 | else |
2220 | final_option = GNUNET_CONFIGURATION_expand_dollar (cfg, | 2225 | final_option = GNUNET_CONFIGURATION_expand_dollar (cfg, |
2221 | final_option); | 2226 | final_option); |
2222 | if (GNUNET_YES == | 2227 | start_user = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
2223 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
2224 | "ARM", | 2228 | "ARM", |
2225 | "USER_ONLY")) | 2229 | "START_USER_SERVICES"); |
2226 | { | 2230 | start_system = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
2227 | GNUNET_break (GNUNET_YES == start_user); | ||
2228 | start_system = GNUNET_NO; | ||
2229 | } | ||
2230 | if (GNUNET_YES == | ||
2231 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
2232 | "ARM", | 2231 | "ARM", |
2233 | "SYSTEM_ONLY")) | 2232 | "START_SYSTEM_SERVICES"); |
2233 | if ( (GNUNET_NO == start_user) && | ||
2234 | (GNUNET_NO == start_system) ) | ||
2234 | { | 2235 | { |
2235 | GNUNET_break (GNUNET_YES == start_system); | 2236 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2236 | start_user = GNUNET_NO; | 2237 | "Please configure either START_USER_SERVICES or START_SYSTEM_SERVICES or both.\n"); |
2238 | GNUNET_SCHEDULER_shutdown (); | ||
2239 | global_ret = 1; | ||
2240 | return; | ||
2237 | } | 2241 | } |
2238 | GNUNET_CONFIGURATION_iterate_sections (cfg, | 2242 | GNUNET_CONFIGURATION_iterate_sections (cfg, |
2239 | &setup_service, | 2243 | &setup_service, |
@@ -2260,7 +2264,6 @@ int | |||
2260 | main (int argc, | 2264 | main (int argc, |
2261 | char *const *argv) | 2265 | char *const *argv) |
2262 | { | 2266 | { |
2263 | int ret; | ||
2264 | struct GNUNET_SIGNAL_Context *shc_chld; | 2267 | struct GNUNET_SIGNAL_Context *shc_chld; |
2265 | struct GNUNET_MQ_MessageHandler handlers[] = { | 2268 | struct GNUNET_MQ_MessageHandler handlers[] = { |
2266 | GNUNET_MQ_hd_var_size (start, | 2269 | GNUNET_MQ_hd_var_size (start, |
@@ -2294,7 +2297,7 @@ main (int argc, | |||
2294 | shc_chld = | 2297 | shc_chld = |
2295 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, | 2298 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, |
2296 | &sighandler_child_death); | 2299 | &sighandler_child_death); |
2297 | ret = GNUNET_SERVICE_run_ (argc, | 2300 | if ( GNUNET_OK != GNUNET_SERVICE_run_ (argc, |
2298 | argv, | 2301 | argv, |
2299 | "arm", | 2302 | "arm", |
2300 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, | 2303 | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN, |
@@ -2302,7 +2305,8 @@ main (int argc, | |||
2302 | &client_connect_cb, | 2305 | &client_connect_cb, |
2303 | &client_disconnect_cb, | 2306 | &client_disconnect_cb, |
2304 | NULL, | 2307 | NULL, |
2305 | handlers); | 2308 | handlers)) |
2309 | global_ret = 2; | ||
2306 | #if HAVE_WAIT4 | 2310 | #if HAVE_WAIT4 |
2307 | if (NULL != wait_file) | 2311 | if (NULL != wait_file) |
2308 | { | 2312 | { |
@@ -2319,7 +2323,7 @@ main (int argc, | |||
2319 | shc_chld = NULL; | 2323 | shc_chld = NULL; |
2320 | GNUNET_DISK_pipe_close (sigpipe); | 2324 | GNUNET_DISK_pipe_close (sigpipe); |
2321 | sigpipe = NULL; | 2325 | sigpipe = NULL; |
2322 | return ret; | 2326 | return global_ret; |
2323 | } | 2327 | } |
2324 | 2328 | ||
2325 | 2329 | ||