diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-11 13:43:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-11 13:43:44 +0000 |
commit | bed8e0d389aacc368b3dd9704d355b284236fea3 (patch) | |
tree | 8fb1826c6f7b09fe09f4a0c456ea58699746db3b /src | |
parent | bd3ab1e9cafa730d9eaf2d1113467ea89de1916b (diff) | |
download | gnunet-bed8e0d389aacc368b3dd9704d355b284236fea3.tar.gz gnunet-bed8e0d389aacc368b3dd9704d355b284236fea3.zip |
fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/arm/gnunet-service-manager.c | 3 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist.c | 25 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_peer1.conf | 10 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_peer2.conf | 8 | ||||
-rw-r--r-- | src/util/service.c | 24 | ||||
-rw-r--r-- | src/util/test_service.c | 33 | ||||
-rw-r--r-- | src/util/test_service_data.conf | 2 |
7 files changed, 19 insertions, 86 deletions
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, | |||
730 | unsigned int i; | 730 | unsigned int i; |
731 | 731 | ||
732 | if ( (strcasecmp (section, "arm") == 0) || | 732 | if ( (strcasecmp (section, "arm") == 0) || |
733 | (strcasecmp (option, "PORT") != 0) || | 733 | (strcasecmp (option, "AUTOSTART") != 0) || |
734 | (strcasecmp (value, "YES") != 0) || | ||
734 | (isInDefaultList (section) == GNUNET_YES) ) | 735 | (isInDefaultList (section) == GNUNET_YES) ) |
735 | return; | 736 | return; |
736 | if (0 >= (ret = GNUNET_SERVICE_get_server_addresses (section, cfg, &addrs, | 737 | 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 | |||
48 | struct GNUNET_CONFIGURATION_Handle *cfg; | 48 | struct GNUNET_CONFIGURATION_Handle *cfg; |
49 | struct GNUNET_TRANSPORT_Handle *th; | 49 | struct GNUNET_TRANSPORT_Handle *th; |
50 | struct GNUNET_MessageHeader *hello; | 50 | struct GNUNET_MessageHeader *hello; |
51 | struct GNUNET_ARM_Handle *arm; | ||
52 | #if START_ARM | 51 | #if START_ARM |
53 | pid_t arm_pid; | 52 | pid_t arm_pid; |
54 | #endif | 53 | #endif |
@@ -145,7 +144,6 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
145 | "-c", cfgname, NULL); | 144 | "-c", cfgname, NULL); |
146 | #endif | 145 | #endif |
147 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 146 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
148 | GNUNET_ARM_start_services (p->cfg, sched, "core", NULL); | ||
149 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, | 147 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, |
150 | ¬ify_connect, NULL); | 148 | ¬ify_connect, NULL); |
151 | GNUNET_assert (p->th != NULL); | 149 | GNUNET_assert (p->th != NULL); |
@@ -174,35 +172,16 @@ waitpid_task (void *cls, | |||
174 | 172 | ||
175 | 173 | ||
176 | static void | 174 | static void |
177 | stop_cb (void *cls, | 175 | stop_arm (struct PeerContext *p) |
178 | int success) | ||
179 | { | 176 | { |
180 | struct PeerContext *p = cls; | ||
181 | |||
182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
183 | success | 178 | "Asking ARM to stop core service\n"); |
184 | ? "ARM stopped core service\n" | ||
185 | : "ARM failed to stop core service\n"); | ||
186 | GNUNET_ARM_disconnect (p->arm); | ||
187 | p->arm = NULL; | ||
188 | /* make sure this runs after all other tasks are done */ | ||
189 | GNUNET_SCHEDULER_add_delayed (sched, | 179 | GNUNET_SCHEDULER_add_delayed (sched, |
190 | GNUNET_TIME_UNIT_SECONDS, | 180 | GNUNET_TIME_UNIT_SECONDS, |
191 | &waitpid_task, p); | 181 | &waitpid_task, p); |
192 | } | 182 | } |
193 | 183 | ||
194 | 184 | ||
195 | static void | ||
196 | stop_arm (struct PeerContext *p) | ||
197 | { | ||
198 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
199 | "Asking ARM to stop core service\n"); | ||
200 | p->arm = GNUNET_ARM_connect (p->cfg, sched, NULL); | ||
201 | GNUNET_ARM_stop_service (p->arm, "core", GNUNET_TIME_UNIT_SECONDS, | ||
202 | &stop_cb, p); | ||
203 | } | ||
204 | |||
205 | |||
206 | /** | 185 | /** |
207 | * Try again to connect to transport service. | 186 | * Try again to connect to transport service. |
208 | */ | 187 | */ |
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 | |||
13 | 13 | ||
14 | [arm] | 14 | [arm] |
15 | PORT = 12966 | 15 | PORT = 12966 |
16 | DEFAULTSERVICES = resolver transport core statistics topology | 16 | DEFAULTSERVICES = hostlist topology |
17 | #GLOBAL_PREFIX = xterm -e gdb -x cmd --args | 17 | #GLOBAL_PREFIX = xterm -e gdb -x cmd --args |
18 | 18 | ||
19 | [statistics] | 19 | [statistics] |
@@ -47,4 +47,10 @@ DEBUG = NO | |||
47 | [topology] | 47 | [topology] |
48 | #DEBUG = YES | 48 | #DEBUG = YES |
49 | #PREFIX = valgrind --tool=memcheck | 49 | #PREFIX = valgrind --tool=memcheck |
50 | DEBUG = NO \ No newline at end of file | 50 | DEBUG = NO |
51 | |||
52 | [fs] | ||
53 | AUTOSTART = NO | ||
54 | |||
55 | [datastore] | ||
56 | 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 | |||
13 | 13 | ||
14 | [arm] | 14 | [arm] |
15 | PORT = 22966 | 15 | PORT = 22966 |
16 | DEFAULTSERVICES = resolver transport core statistics topology | 16 | DEFAULTSERVICES = hostlist topology |
17 | #GLOBAL_PREFIX = xterm -e gdb -x cmd --args | 17 | #GLOBAL_PREFIX = xterm -e gdb -x cmd --args |
18 | DEBUG = NO | 18 | DEBUG = NO |
19 | 19 | ||
@@ -47,3 +47,9 @@ HOSTLISTFILE = hostlists_peer2.file | |||
47 | #DEBUG = YES | 47 | #DEBUG = YES |
48 | #PREFIX = valgrind --tool=memcheck | 48 | #PREFIX = valgrind --tool=memcheck |
49 | DEBUG = NO | 49 | DEBUG = NO |
50 | |||
51 | [fs] | ||
52 | AUTOSTART = NO | ||
53 | |||
54 | [datastore] | ||
55 | 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 | |||
@@ -511,11 +511,6 @@ struct GNUNET_SERVICE_Context | |||
511 | int require_found; | 511 | int require_found; |
512 | 512 | ||
513 | /** | 513 | /** |
514 | * Can clients ask us to initiate a shutdown? | ||
515 | */ | ||
516 | int allow_shutdown; | ||
517 | |||
518 | /** | ||
519 | * Our options. | 514 | * Our options. |
520 | */ | 515 | */ |
521 | enum GNUNET_SERVICE_Options options; | 516 | enum GNUNET_SERVICE_Options options; |
@@ -944,7 +939,6 @@ GNUNET_SERVICE_get_server_addresses (const char *serviceName, | |||
944 | * - TIMEOUT (after how many ms does an inactive service timeout); | 939 | * - TIMEOUT (after how many ms does an inactive service timeout); |
945 | * - MAXBUF (maximum incoming message size supported) | 940 | * - MAXBUF (maximum incoming message size supported) |
946 | * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) | 941 | * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack) |
947 | * - ALLOW_SHUTDOWN (allow clients to shutdown this service) | ||
948 | * - BINDTO (hostname or IP address to bind to, otherwise we take everything) | 942 | * - BINDTO (hostname or IP address to bind to, otherwise we take everything) |
949 | * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) | 943 | * - ACCEPT_FROM (only allow connections from specified IPv4 subnets) |
950 | * - ACCEPT_FROM6 (only allow connections from specified IPv6 subnets) | 944 | * - ACCEPT_FROM6 (only allow connections from specified IPv6 subnets) |
@@ -995,24 +989,6 @@ setup_service (struct GNUNET_SERVICE_Context *sctx) | |||
995 | } | 989 | } |
996 | else | 990 | else |
997 | maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; | 991 | maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; |
998 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | ||
999 | sctx->serviceName, "ALLOW_SHUTDOWN")) | ||
1000 | { | ||
1001 | if (GNUNET_SYSERR == | ||
1002 | (sctx->allow_shutdown = | ||
1003 | GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg, sctx->serviceName, | ||
1004 | "ALLOW_SHUTDOWN"))) | ||
1005 | { | ||
1006 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1007 | _("Specified value for `%s' of service `%s' is invalid\n"), | ||
1008 | "ALLOW_SHUTDOWN", | ||
1009 | sctx->serviceName); | ||
1010 | return GNUNET_SYSERR; | ||
1011 | } | ||
1012 | } | ||
1013 | else | ||
1014 | sctx->allow_shutdown = GNUNET_NO; | ||
1015 | |||
1016 | 992 | ||
1017 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, | 993 | if (GNUNET_CONFIGURATION_have_value (sctx->cfg, |
1018 | sctx->serviceName, "TOLERANT")) | 994 | 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 () | |||
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | /** | ||
210 | * Main method, starts scheduler with task1, | ||
211 | * checks that "ok" is correct at the end. | ||
212 | */ | ||
213 | static int | ||
214 | check6d () | ||
215 | { | ||
216 | ok = 1; | ||
217 | char *const argv[] = { | ||
218 | "test_service6", | ||
219 | "-c", | ||
220 | "test_service_data.conf", | ||
221 | "-L", | ||
222 | #if VERBOSE | ||
223 | "DEBUG", | ||
224 | #else | ||
225 | "WARNING", | ||
226 | #endif | ||
227 | "-d", | ||
228 | NULL | ||
229 | }; | ||
230 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting V6 as daemon\n"); | ||
231 | GNUNET_assert (GNUNET_OK == | ||
232 | GNUNET_SERVICE_run (6, | ||
233 | argv, | ||
234 | "test_service6", | ||
235 | GNUNET_SERVICE_OPTION_NONE, | ||
236 | &runner6, &ok)); | ||
237 | GNUNET_break (0 == ok); | ||
238 | return ok; | ||
239 | } | ||
240 | |||
241 | 209 | ||
242 | static void | 210 | static void |
243 | start_stop_main (void *cls, | 211 | start_stop_main (void *cls, |
@@ -322,7 +290,6 @@ main (int argc, char *argv[]) | |||
322 | { | 290 | { |
323 | GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s)); | 291 | GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s)); |
324 | ret += check6 (); | 292 | ret += check6 (); |
325 | ret += check6d (); /* with daemonization */ | ||
326 | } | 293 | } |
327 | ret += check_start_stop (); | 294 | ret += check_start_stop (); |
328 | 295 | ||
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; | |||
10 | ACCEPT_FROM6=::1; | 10 | ACCEPT_FROM6=::1; |
11 | REJECT_FROM6=AB:CD:EF::00;AB:CD::00/40; | 11 | REJECT_FROM6=AB:CD:EF::00;AB:CD::00/40; |
12 | HOSTNAME=localhost | 12 | HOSTNAME=localhost |
13 | ALLOW_SHUTDOWN=YES | ||
14 | 13 | ||
15 | [test_service6] | 14 | [test_service6] |
16 | PORT=12435 | 15 | 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; | |||
23 | ACCEPT_FROM6=::1; | 22 | ACCEPT_FROM6=::1; |
24 | REJECT_FROM6=AB:CD:EF::00;AB:CD::00/40; | 23 | REJECT_FROM6=AB:CD:EF::00;AB:CD::00/40; |
25 | HOSTNAME=::1 | 24 | HOSTNAME=::1 |
26 | ALLOW_SHUTDOWN=YES | ||
27 | 25 | ||
28 | [resolver] | 26 | [resolver] |
29 | HOSTNAME=localhost | 27 | HOSTNAME=localhost |