gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8573 - in gnunet: . src/arm src/include


From: gnunet
Subject: [GNUnet-SVN] r8573 - in gnunet: . src/arm src/include
Date: Sun, 14 Jun 2009 20:44:19 -0600

Author: grothoff
Date: 2009-06-14 20:44:19 -0600 (Sun, 14 Jun 2009)
New Revision: 8573

Modified:
   gnunet/TODO
   gnunet/src/arm/arm_api.c
   gnunet/src/arm/gnunet-service-arm.c
   gnunet/src/include/gnunet_arm_service.h
   gnunet/src/include/gnunet_protocols.h
Log:
better support for daemons

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2009-06-15 02:37:34 UTC (rev 8572)
+++ gnunet/TODO 2009-06-15 02:44:19 UTC (rev 8573)
@@ -1,8 +1,5 @@
 PHASE #1: (Goal: settle key design questions)
 
-ARM:
-* Make sure ARM supports daemons (non-service background processes, see 
hostlist/topology)
-
 Util:
 * improve disk API [Nils]
 * Windows: use events instead of pipes to signal select()s [Nils]

Modified: gnunet/src/arm/arm_api.c
===================================================================
--- gnunet/src/arm/arm_api.c    2009-06-15 02:37:34 UTC (rev 8572)
+++ gnunet/src/arm/arm_api.c    2009-06-15 02:44:19 UTC (rev 8573)
@@ -129,6 +129,9 @@
     case GNUNET_MESSAGE_TYPE_ARM_IS_DOWN:
       ret = GNUNET_NO;
       break;
+    case GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN:
+      ret = GNUNET_SYSERR;
+      break;
     default:
       GNUNET_break (0);
       ret = GNUNET_SYSERR;

Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2009-06-15 02:37:34 UTC (rev 8572)
+++ gnunet/src/arm/gnunet-service-arm.c 2009-06-15 02:44:19 UTC (rev 8573)
@@ -412,6 +412,7 @@
 {
   struct ServiceList *pos;
   struct GNUNET_CLIENT_Connection *sc;
+  unsigned long long port;
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Preparing to stop `%s'\n", servicename);
@@ -444,10 +445,21 @@
     }
   else
     {
-      sc = GNUNET_CLIENT_connect (sched, servicename, cfg);
-      GNUNET_CLIENT_service_shutdown (sc);
-      GNUNET_CLIENT_disconnect (sc);
-      signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN);
+      if ( (GNUNET_OK ==
+           GNUNET_CONFIGURATION_get_value_number (cfg,
+                                                  servicename,
+                                                  "PORT",
+                                                  &port)) &&
+          (NULL != (sc = GNUNET_CLIENT_connect (sched, servicename, cfg))) )
+       {
+         GNUNET_CLIENT_service_shutdown (sc);
+         GNUNET_CLIENT_disconnect (sc);
+         signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN);
+       }
+      else
+       {
+         signal_result (client, servicename, 
GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN);
+       }
       GNUNET_SERVER_receive_done (client, GNUNET_OK);
     }
 }

Modified: gnunet/src/include/gnunet_arm_service.h
===================================================================
--- gnunet/src/include/gnunet_arm_service.h     2009-06-15 02:37:34 UTC (rev 
8572)
+++ gnunet/src/include/gnunet_arm_service.h     2009-06-15 02:44:19 UTC (rev 
8573)
@@ -51,7 +51,8 @@
  * @param cls closure
  * @param success GNUNET_YES if we think the service is running
  *                GNUNET_NO if we think the service is stopped
- *                GNUNET_SYSERR if we think ARM was not running
+ *                GNUNET_SYSERR if we think ARM was not running or
+ *                          if the service status is unknown
  */
 typedef void (*GNUNET_ARM_Callback) (void *cls, int success);
 

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2009-06-15 02:37:34 UTC (rev 
8572)
+++ gnunet/src/include/gnunet_protocols.h       2009-06-15 02:44:19 UTC (rev 
8573)
@@ -95,11 +95,16 @@
 
 /**
  * Response from ARM: service is now down.
- * (failed to start it).
+ * (failed to start it or shut it down).
  */
 #define GNUNET_MESSAGE_TYPE_ARM_IS_DOWN 11
 
+/**
+ * Response from ARM: service status is unknown.
+ */
+#define GNUNET_MESSAGE_TYPE_ARM_IS_UNKNOWN 12
 
+
 /**
  * HELLO message used for communicating peer addresses.
  * Managed by libgnunethello.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]