aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-06-15 02:44:19 +0000
committerChristian Grothoff <christian@grothoff.org>2009-06-15 02:44:19 +0000
commit9827cc8e21bef6d8e06ba6924dfc8114622647ba (patch)
treede74c9eb1b5ca0ad92ed558e0489a68ee5c97064
parent8aabcda325071d9a4ba3a26bf2b12570812437fd (diff)
downloadgnunet-9827cc8e21bef6d8e06ba6924dfc8114622647ba.tar.gz
gnunet-9827cc8e21bef6d8e06ba6924dfc8114622647ba.zip
better support for daemons
-rw-r--r--TODO3
-rw-r--r--src/arm/arm_api.c3
-rw-r--r--src/arm/gnunet-service-arm.c20
-rw-r--r--src/include/gnunet_arm_service.h3
-rw-r--r--src/include/gnunet_protocols.h7
5 files changed, 27 insertions, 9 deletions
diff --git a/TODO b/TODO
index 7231181a2..029a3558c 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,5 @@
1PHASE #1: (Goal: settle key design questions) 1PHASE #1: (Goal: settle key design questions)
2 2
3ARM:
4* Make sure ARM supports daemons (non-service background processes, see hostlist/topology)
5
6Util: 3Util:
7* improve disk API [Nils] 4* improve disk API [Nils]
8* Windows: use events instead of pipes to signal select()s [Nils] 5* Windows: use events instead of pipes to signal select()s [Nils]
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index c5bb15fd3..7f120e6a6 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -129,6 +129,9 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg)
129 case GNUNET_MESSAGE_TYPE_ARM_IS_DOWN: 129 case GNUNET_MESSAGE_TYPE_ARM_IS_DOWN:
130 ret = GNUNET_NO; 130 ret = GNUNET_NO;
131 break; 131 break;
132 case GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN:
133 ret = GNUNET_SYSERR;
134 break;
132 default: 135 default:
133 GNUNET_break (0); 136 GNUNET_break (0);
134 ret = GNUNET_SYSERR; 137 ret = GNUNET_SYSERR;
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 66df86e45..1953bffeb 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -412,6 +412,7 @@ stop_service (struct GNUNET_SERVER_Client *client, const char *servicename)
412{ 412{
413 struct ServiceList *pos; 413 struct ServiceList *pos;
414 struct GNUNET_CLIENT_Connection *sc; 414 struct GNUNET_CLIENT_Connection *sc;
415 unsigned long long port;
415 416
416 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 417 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
417 "Preparing to stop `%s'\n", servicename); 418 "Preparing to stop `%s'\n", servicename);
@@ -444,10 +445,21 @@ stop_service (struct GNUNET_SERVER_Client *client, const char *servicename)
444 } 445 }
445 else 446 else
446 { 447 {
447 sc = GNUNET_CLIENT_connect (sched, servicename, cfg); 448 if ( (GNUNET_OK ==
448 GNUNET_CLIENT_service_shutdown (sc); 449 GNUNET_CONFIGURATION_get_value_number (cfg,
449 GNUNET_CLIENT_disconnect (sc); 450 servicename,
450 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); 451 "PORT",
452 &port)) &&
453 (NULL != (sc = GNUNET_CLIENT_connect (sched, servicename, cfg))) )
454 {
455 GNUNET_CLIENT_service_shutdown (sc);
456 GNUNET_CLIENT_disconnect (sc);
457 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN);
458 }
459 else
460 {
461 signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN);
462 }
451 GNUNET_SERVER_receive_done (client, GNUNET_OK); 463 GNUNET_SERVER_receive_done (client, GNUNET_OK);
452 } 464 }
453} 465}
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h
index 012c27877..5a929a37e 100644
--- a/src/include/gnunet_arm_service.h
+++ b/src/include/gnunet_arm_service.h
@@ -51,7 +51,8 @@ extern "C"
51 * @param cls closure 51 * @param cls closure
52 * @param success GNUNET_YES if we think the service is running 52 * @param success GNUNET_YES if we think the service is running
53 * GNUNET_NO if we think the service is stopped 53 * GNUNET_NO if we think the service is stopped
54 * GNUNET_SYSERR if we think ARM was not running 54 * GNUNET_SYSERR if we think ARM was not running or
55 * if the service status is unknown
55 */ 56 */
56typedef void (*GNUNET_ARM_Callback) (void *cls, int success); 57typedef void (*GNUNET_ARM_Callback) (void *cls, int success);
57 58
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index c86ad83ce..342014ae1 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -95,10 +95,15 @@ extern "C"
95 95
96/** 96/**
97 * Response from ARM: service is now down. 97 * Response from ARM: service is now down.
98 * (failed to start it). 98 * (failed to start it or shut it down).
99 */ 99 */
100#define GNUNET_MESSAGE_TYPE_ARM_IS_DOWN 11 100#define GNUNET_MESSAGE_TYPE_ARM_IS_DOWN 11
101 101
102/**
103 * Response from ARM: service status is unknown.
104 */
105#define GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN 12
106
102 107
103/** 108/**
104 * HELLO message used for communicating peer addresses. 109 * HELLO message used for communicating peer addresses.