From df64e68d7a864d9204c44c82cc32696393161bb1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 23 Dec 2013 22:34:19 +0000 Subject: -fix issues with multi-user setup and ARM --- po/de.po | 6 ++- po/es.po | 6 ++- po/sv.po | 6 ++- po/vi.po | 6 ++- po/zh_CN.po | 6 ++- src/arm/arm_api.c | 11 ++++-- src/arm/gnunet-service-arm.c | 94 ++++++++++++++++++++++++-------------------- 7 files changed, 84 insertions(+), 51 deletions(-) diff --git a/po/de.po b/po/de.po index 2dc5731a5..145059278 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNUnet 0.7.0b\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2013-12-23 22:41+0100\n" +"POT-Creation-Date: 2013-12-23 22:54+0100\n" "PO-Revision-Date: 2006-03-17 21:37+0100\n" "Last-Translator: Nils Durner \n" "Language-Team: German \n" @@ -4082,6 +4082,10 @@ msgstr "" msgid "Failed to connect to identity service\n" msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" +#: src/gns/gnunet-gns-import.c:476 +msgid "This program will import some GNS authorities into your GNS namestore." +msgstr "" + #: src/gns/gnunet-gns-proxy.c:105 src/hostlist/hostlist-client.c:469 #: src/hostlist/hostlist-client.c:683 src/hostlist/hostlist-client.c:689 #: src/hostlist/hostlist-client.c:741 src/hostlist/hostlist-client.c:750 diff --git a/po/es.po b/po/es.po index 22b2a9682..52088913b 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.9.5a\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2013-12-23 22:41+0100\n" +"POT-Creation-Date: 2013-12-23 22:54+0100\n" "PO-Revision-Date: 2013-02-23 17:50+0100\n" "Last-Translator: Miguel Ángel Arruga Vivas \n" "Language-Team: Spanish \n" @@ -4087,6 +4087,10 @@ msgstr "" msgid "Failed to connect to identity service\n" msgstr "Fallo al conectar a gnunetd.\n" +#: src/gns/gnunet-gns-import.c:476 +msgid "This program will import some GNS authorities into your GNS namestore." +msgstr "" + #: src/gns/gnunet-gns-proxy.c:105 src/hostlist/hostlist-client.c:469 #: src/hostlist/hostlist-client.c:683 src/hostlist/hostlist-client.c:689 #: src/hostlist/hostlist-client.c:741 src/hostlist/hostlist-client.c:750 diff --git a/po/sv.po b/po/sv.po index 6d6aa3766..d926abcb9 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: GNUnet 0.7.0b\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2013-12-23 22:41+0100\n" +"POT-Creation-Date: 2013-12-23 22:54+0100\n" "PO-Revision-Date: 2006-01-21 17:16+0100\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" @@ -4031,6 +4031,10 @@ msgstr "" msgid "Failed to connect to identity service\n" msgstr "Misslyckades att ansluta till gnunetd.\n" +#: src/gns/gnunet-gns-import.c:476 +msgid "This program will import some GNS authorities into your GNS namestore." +msgstr "" + #: src/gns/gnunet-gns-proxy.c:105 src/hostlist/hostlist-client.c:469 #: src/hostlist/hostlist-client.c:683 src/hostlist/hostlist-client.c:689 #: src/hostlist/hostlist-client.c:741 src/hostlist/hostlist-client.c:750 diff --git a/po/vi.po b/po/vi.po index da8a08d6d..5a6ed8844 100644 --- a/po/vi.po +++ b/po/vi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet 0.8.0a\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2013-12-23 22:41+0100\n" +"POT-Creation-Date: 2013-12-23 22:54+0100\n" "PO-Revision-Date: 2008-09-10 22:05+0930\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" @@ -4082,6 +4082,10 @@ msgstr "" msgid "Failed to connect to identity service\n" msgstr "Lỗi kết nối đến gnunetd.\n" +#: src/gns/gnunet-gns-import.c:476 +msgid "This program will import some GNS authorities into your GNS namestore." +msgstr "" + #: src/gns/gnunet-gns-proxy.c:105 src/hostlist/hostlist-client.c:469 #: src/hostlist/hostlist-client.c:683 src/hostlist/hostlist-client.c:689 #: src/hostlist/hostlist-client.c:741 src/hostlist/hostlist-client.c:750 diff --git a/po/zh_CN.po b/po/zh_CN.po index c9e9ee1ba..4b9ae77f0 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gnunet-0.8.1\n" "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" -"POT-Creation-Date: 2013-12-23 22:41+0100\n" +"POT-Creation-Date: 2013-12-23 22:54+0100\n" "PO-Revision-Date: 2011-07-09 12:12+0800\n" "Last-Translator: Wylmer Wang \n" "Language-Team: Chinese (simplified) \n" @@ -3879,6 +3879,10 @@ msgstr "" msgid "Failed to connect to identity service\n" msgstr "初始化“%s”服务失败。\n" +#: src/gns/gnunet-gns-import.c:476 +msgid "This program will import some GNS authorities into your GNS namestore." +msgstr "" + #: src/gns/gnunet-gns-proxy.c:105 src/hostlist/hostlist-client.c:469 #: src/hostlist/hostlist-client.c:683 src/hostlist/hostlist-client.c:689 #: src/hostlist/hostlist-client.c:741 src/hostlist/hostlist-client.c:750 diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 6c0dec4a6..ee699739a 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -308,11 +308,12 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg) /** * Handler for ARM replies. * - * @param cls our "struct GNUNET_ARM_Handle" + * @param cls our `struct GNUNET_ARM_Handle` * @param msg the message received from the arm service */ static void -client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) +client_notify_handler (void *cls, + const struct GNUNET_MessageHeader *msg) { struct GNUNET_ARM_Handle *h = cls; const struct GNUNET_ARM_Message *arm_msg; @@ -353,7 +354,9 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) cm = find_cm_by_id (h, id); if (NULL == cm) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Message with unknown id %llu\n", + id); return; } fail = GNUNET_NO; @@ -460,7 +463,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) if (NULL != cm->list_cont) cm->list_cont (cm->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, rcount, list); - GNUNET_free (list); + GNUNET_free_non_null (list); break; } GNUNET_free (cm->msg); diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 704b6f2fc..af232b11c 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -260,7 +260,7 @@ write_result (void *cls, size_t size, void *buf) struct GNUNET_ARM_ResultMessage *msg = cls; size_t msize; - if (buf == NULL) + if (NULL == buf) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Could not send status result to client\n")); @@ -296,7 +296,7 @@ write_list_result (void *cls, size_t size, void *buf) struct GNUNET_ARM_ListResultMessage *msg = cls; size_t rslt_size; - if (buf == NULL) + if (NULL == buf) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Could not send list result to client\n")); @@ -525,14 +525,19 @@ start_process (struct ServiceList *sl, GNUNET_free (quotedbinary); if (sl->proc == NULL) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start service `%s'\n"), + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to start service `%s'\n"), sl->name); if (client) - signal_result (client, sl->name, request_id, GNUNET_ARM_RESULT_START_FAILED); + signal_result (client, + sl->name, + request_id, + GNUNET_ARM_RESULT_START_FAILED); } else { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Starting service `%s'\n"), + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _("Starting service `%s'\n"), sl->name); broadcast_status (sl->name, GNUNET_ARM_SERVICE_STARTING, NULL); if (client) @@ -903,7 +908,7 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client, /* first count the running processes get their name's size */ for (sl = running_head; NULL != sl; sl = sl->next) { - if (sl->proc != NULL) + if (NULL != sl->proc) { string_list_size += strlen (sl->name); string_list_size += strlen (sl->binary); @@ -922,20 +927,19 @@ handle_list (void *cls, struct GNUNET_SERVER_Client *client, msg->count = count; char *pos = (char *)&msg[1]; - for (sl = running_head; sl != NULL; sl = sl->next) + for (sl = running_head; NULL != sl; sl = sl->next) { - if (sl->proc != NULL) + if (NULL != sl->proc) { size_t s = strlen (sl->name) + strlen (sl->binary) + 4; - GNUNET_snprintf(pos, s, "%s (%s)", sl->name, sl->binary); + GNUNET_snprintf (pos, s, "%s (%s)", sl->name, sl->binary); pos += s; } } - GNUNET_SERVER_notify_transmit_ready (client, total_size, GNUNET_TIME_UNIT_FOREVER_REL, - write_list_result, msg); + &write_list_result, msg); GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -966,6 +970,12 @@ do_shutdown () } +/** + * Count how many services are still active. + * + * @param running_head list of services + * @return number of active services found + */ static unsigned int list_count (struct ServiceList *running_head) { @@ -1442,8 +1452,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *serv, cfg = c; server = serv; - GNUNET_assert (serv != NULL); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, + GNUNET_assert (NULL != serv); + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + &shutdown_task, NULL); child_death_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, @@ -1464,50 +1475,49 @@ run (void *cls, struct GNUNET_SERVER_Handle *serv, { GNUNET_break (GNUNET_YES == start_user); start_system = GNUNET_NO; - return; } if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", "SYSTEM_ONLY")) { GNUNET_break (GNUNET_YES == start_system); start_user = GNUNET_NO; - return; } GNUNET_CONFIGURATION_iterate_sections (cfg, &setup_service, NULL); /* start default services... */ if (GNUNET_OK == - GNUNET_CONFIGURATION_get_value_string (cfg, "ARM", "DEFAULTSERVICES", + GNUNET_CONFIGURATION_get_value_string (cfg, + "ARM", + "DEFAULTSERVICES", &defaultservices)) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _("Starting default services `%s'\n"), + defaultservices); + if (0 < strlen (defaultservices)) { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _("Starting default services `%s'\n"), defaultservices); - if (0 < strlen (defaultservices)) - { - for (pos = strtok (defaultservices, " "); NULL != pos; - pos = strtok (NULL, " ")) - { - sl = find_service (pos); - if (NULL == sl) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _ - ("Default service `%s' not configured correctly!\n"), - pos); - continue; - } - sl->is_default = GNUNET_YES; - start_process (sl, NULL, 0); - } - } - GNUNET_free (defaultservices); + for (pos = strtok (defaultservices, " "); NULL != pos; + pos = strtok (NULL, " ")) + { + sl = find_service (pos); + if (NULL == sl) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Default service `%s' not configured correctly!\n"), + pos); + continue; + } + sl->is_default = GNUNET_YES; + start_process (sl, NULL, 0); + } } + GNUNET_free (defaultservices); + } else - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - _ - ("No default services configured, GNUnet will not really start right now.\n")); - } + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + _("No default services configured, GNUnet will not really start right now.\n")); + } notifier = GNUNET_SERVER_notification_context_create (server, MAX_NOTIFY_QUEUE); -- cgit v1.2.3