From bed8e0d389aacc368b3dd9704d355b284236fea3 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 11 May 2010 13:43:44 +0000 Subject: [PATCH] fixes --- contrib/defaults.conf | 16 ++++----- src/arm/gnunet-service-manager.c | 3 +- src/hostlist/test_gnunet_daemon_hostlist.c | 25 ++------------ .../test_gnunet_daemon_hostlist_peer1.conf | 10 ++++-- .../test_gnunet_daemon_hostlist_peer2.conf | 8 ++++- src/util/service.c | 24 -------------- src/util/test_service.c | 33 ------------------- src/util/test_service_data.conf | 2 -- 8 files changed, 26 insertions(+), 95 deletions(-) diff --git a/contrib/defaults.conf b/contrib/defaults.conf index 1760d9a48..8aac5049e 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf @@ -18,7 +18,6 @@ HOME = $SERVICEHOME [transport-tcp] PORT = 2086 TIMEOUT = 300000 -ALLOW_SHUTDOWN = NO # MAXBUF = # DISABLEV6 = # BINDTO = @@ -36,7 +35,6 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-arm ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES DEFAULTSERVICES = resolver transport core topology hostlist # GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs # GLOBAL_PREFIX = @@ -50,6 +48,7 @@ DEFAULTSERVICES = resolver transport core topology hostlist # PREFIX = [statistics] +AUTOSTART = YES PORT = 2088 HOSTNAME = localhost HOME = $SERVICEHOME @@ -57,7 +56,6 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-statistics ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES # USERNAME = # MAXBUF = # TIMEOUT = @@ -68,6 +66,7 @@ ALLOW_SHUTDOWN = YES # PREFIX = [resolver] +AUTOSTART = YES PORT = 2089 HOSTNAME = localhost HOME = $SERVICEHOME @@ -75,7 +74,6 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-resolver ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES # USERNAME = # MAXBUF = # TIMEOUT = @@ -86,6 +84,7 @@ ALLOW_SHUTDOWN = YES # PREFIX = [peerinfo] +AUTOSTART = YES PORT = 2090 HOSTNAME = localhost HOME = $SERVICEHOME @@ -93,7 +92,6 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-peerinfo ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES # USERNAME = # MAXBUF = # TIMEOUT = @@ -107,6 +105,7 @@ TRUST = $SERVICEHOME/data/credit/ [transport] +AUTOSTART = YES PORT = 2091 HOSTNAME = localhost HOME = $SERVICEHOME @@ -115,7 +114,6 @@ BINARY = gnunet-service-transport NEIGHBOUR_LIMIT = 50 ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES PLUGINS = tcp # USERNAME = # MAXBUF = @@ -127,6 +125,7 @@ PLUGINS = tcp # PREFIX = [core] +AUTOSTART = YES PORT = 2092 HOSTNAME = localhost HOME = $SERVICEHOME @@ -134,7 +133,6 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-core ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES # quotas are in bytes per second now! TOTAL_QUOTA_IN = 65536 TOTAL_QUOTA_OUT = 65536 @@ -173,6 +171,7 @@ HTTP-PROXY = [datastore] +AUTOSTART = YES PORT = 2093 HOSTNAME = localhost HOME = $SERVICEHOME @@ -180,7 +179,6 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-datastore ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES QUOTA = 100000000 BLOOMFILTER = $SERVICEHOME/fs/bloomfilter DATABASE = sqlite @@ -189,6 +187,7 @@ DATABASE = sqlite FILENAME = $SERVICEHOME/datastore/sqlite.db [fs] +AUTOSTART = YES INDEXDB = $SERVICEHOME/idxinfo.lst IDENTITY_DIR = $SERVICEHOME/identities/ STATE_DIR = $SERVICEHOME/persistence/ @@ -199,6 +198,5 @@ CONFIG = $DEFAULTCONFIG BINARY = gnunet-service-fs ACCEPT_FROM = 127.0.0.1; ACCEPT_FROM6 = ::1; -ALLOW_SHUTDOWN = YES # DEBUG = YES diff --git a/src/arm/gnunet-service-manager.c b/src/arm/gnunet-service-manager.c index a55991050..79a5e5043 100644 --- a/src/arm/gnunet-service-manager.c +++ b/src/arm/gnunet-service-manager.c @@ -730,7 +730,8 @@ checkPortNumberCB (void *cls, unsigned int i; if ( (strcasecmp (section, "arm") == 0) || - (strcasecmp (option, "PORT") != 0) || + (strcasecmp (option, "AUTOSTART") != 0) || + (strcasecmp (value, "YES") != 0) || (isInDefaultList (section) == GNUNET_YES) ) return; if (0 >= (ret = GNUNET_SERVICE_get_server_addresses (section, cfg, &addrs, diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index a8f092121..3e179e5d9 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c @@ -48,7 +48,6 @@ struct PeerContext struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_TRANSPORT_Handle *th; struct GNUNET_MessageHeader *hello; - struct GNUNET_ARM_Handle *arm; #if START_ARM pid_t arm_pid; #endif @@ -145,7 +144,6 @@ setup_peer (struct PeerContext *p, const char *cfgname) "-c", cfgname, NULL); #endif GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); - GNUNET_ARM_start_services (p->cfg, sched, "core", NULL); p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, ¬ify_connect, NULL); GNUNET_assert (p->th != NULL); @@ -174,35 +172,16 @@ waitpid_task (void *cls, static void -stop_cb (void *cls, - int success) +stop_arm (struct PeerContext *p) { - struct PeerContext *p = cls; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - success - ? "ARM stopped core service\n" - : "ARM failed to stop core service\n"); - GNUNET_ARM_disconnect (p->arm); - p->arm = NULL; - /* make sure this runs after all other tasks are done */ + "Asking ARM to stop core service\n"); GNUNET_SCHEDULER_add_delayed (sched, GNUNET_TIME_UNIT_SECONDS, &waitpid_task, p); } -static void -stop_arm (struct PeerContext *p) -{ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Asking ARM to stop core service\n"); - p->arm = GNUNET_ARM_connect (p->cfg, sched, NULL); - GNUNET_ARM_stop_service (p->arm, "core", GNUNET_TIME_UNIT_SECONDS, - &stop_cb, p); -} - - /** * Try again to connect to transport service. */ diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf index 31aac4bdf..2a46763bf 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf +++ b/src/hostlist/test_gnunet_daemon_hostlist_peer1.conf @@ -13,7 +13,7 @@ DEBUG = NO [arm] PORT = 12966 -DEFAULTSERVICES = resolver transport core statistics topology +DEFAULTSERVICES = hostlist topology #GLOBAL_PREFIX = xterm -e gdb -x cmd --args [statistics] @@ -47,4 +47,10 @@ DEBUG = NO [topology] #DEBUG = YES #PREFIX = valgrind --tool=memcheck -DEBUG = NO \ No newline at end of file +DEBUG = NO + +[fs] +AUTOSTART = NO + +[datastore] +AUTOSTART = NO[fs] diff --git a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf index f23488dfd..c256c2829 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf +++ b/src/hostlist/test_gnunet_daemon_hostlist_peer2.conf @@ -13,7 +13,7 @@ DEBUG = NO [arm] PORT = 22966 -DEFAULTSERVICES = resolver transport core statistics topology +DEFAULTSERVICES = hostlist topology #GLOBAL_PREFIX = xterm -e gdb -x cmd --args DEBUG = NO @@ -47,3 +47,9 @@ HOSTLISTFILE = hostlists_peer2.file #DEBUG = YES #PREFIX = valgrind --tool=memcheck DEBUG = NO + +[fs] +AUTOSTART = NO + +[datastore] +AUTOSTART = NO \ No newline at end of file diff --git a/src/util/service.c b/src/util/service.c index 2022395f7..82e7070a1 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -510,11 +510,6 @@ struct GNUNET_SERVICE_Context */ int require_found; - /** - * Can clients ask us to initiate a shutdown? - */ - int allow_shutdown; - /** * Our options. */ @@ -944,7 +939,6 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, * - TIMEOUT (after how many ms does an inactive service timeout); * - MAXBUF (maximum incoming message size supported) * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) - * - ALLOW_SHUTDOWN (allow clients to shutdown this service) * - BINDTO (hostname or IP address to bind to, otherwise we take everything) * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) * - ACCEPT_FROM6 (only allow connections from specified IPv6 subnets) @@ -995,24 +989,6 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) } else maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; - if (GNUNET_CONFIGURATION_have_value (sctx->cfg, - sctx->serviceName, "ALLOW_SHUTDOWN")) - { - if (GNUNET_SYSERR == - (sctx->allow_shutdown = - GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName, - "ALLOW_SHUTDOWN"))) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Specified value for `%s' of service `%s' is invalid\n"), - "ALLOW_SHUTDOWN", - sctx->serviceName); - return GNUNET_SYSERR; - } - } - else - sctx->allow_shutdown = GNUNET_NO; - if (GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->serviceName, "TOLERANT")) diff --git a/src/util/test_service.c b/src/util/test_service.c index c406a0f24..6148fa2cc 100644 --- a/src/util/test_service.c +++ b/src/util/test_service.c @@ -206,38 +206,6 @@ check6 () } -/** - * Main method, starts scheduler with task1, - * checks that "ok" is correct at the end. - */ -static int -check6d () -{ - ok = 1; - char *const argv[] = { - "test_service6", - "-c", - "test_service_data.conf", - "-L", -#if VERBOSE - "DEBUG", -#else - "WARNING", -#endif - "-d", - NULL - }; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting V6 as daemon\n"); - GNUNET_assert (GNUNET_OK == - GNUNET_SERVICE_run (6, - argv, - "test_service6", - GNUNET_SERVICE_OPTION_NONE, - &runner6, &ok)); - GNUNET_break (0 == ok); - return ok; -} - static void start_stop_main (void *cls, @@ -322,7 +290,6 @@ main (int argc, char *argv[]) { GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s)); ret += check6 (); - ret += check6d (); /* with daemonization */ } ret += check_start_stop (); diff --git a/src/util/test_service_data.conf b/src/util/test_service_data.conf index d3a3e8278..cff43ccb0 100644 --- a/src/util/test_service_data.conf +++ b/src/util/test_service_data.conf @@ -10,7 +10,6 @@ REJECT_FROM=1.2.3.0/15;4.5.0.0/8;6.7.8.9/255.255.255.0; ACCEPT_FROM6=::1; REJECT_FROM6=AB:CD:EF::00;AB:CD::00/40; HOSTNAME=localhost -ALLOW_SHUTDOWN=YES [test_service6] PORT=12435 @@ -23,7 +22,6 @@ REJECT_FROM=1.2.3.0/15;4.5.0.0/8;6.7.8.9/255.255.255.0; ACCEPT_FROM6=::1; REJECT_FROM6=AB:CD:EF::00;AB:CD::00/40; HOSTNAME=::1 -ALLOW_SHUTDOWN=YES [resolver] HOSTNAME=localhost -- 2.25.1