stuff
authorChristian Grothoff <christian@grothoff.org>
Tue, 11 May 2010 12:56:52 +0000 (12:56 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 11 May 2010 12:56:52 +0000 (12:56 +0000)
src/arm/arm_api.c
src/arm/gnunet-service-manager.c
src/arm/mockup-service.c
src/arm/test_arm_api_data.conf
src/arm/test_exponential_backoff.c
src/arm/test_gnunet_service_manager.c
src/util/client.c
src/util/service.c

index 26ed590a2bde4abb933ed55ae0625e0f4aebed6c..ee53fd87bd3c280abd5c44fcd70c290d8523bbf0 100644 (file)
@@ -482,19 +482,19 @@ GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h,
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _("Stopping service `%s' within %llu ms\n"), service_name,
              (unsigned long long) timeout.value);
-  if (0 == strcasecmp ("arm", service_name))
+  if (h->client == NULL)
     {
-      if (h->client == NULL)
+      client = GNUNET_CLIENT_connect (h->sched, "arm", h->cfg);
+      if (client == NULL)
        {
-         client = GNUNET_CLIENT_connect (h->sched, "arm", h->cfg);
-         if (client == NULL)
-           {
-             cb (cb_cls, GNUNET_SYSERR);
-             return;
-           }
-         GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES);
-         h->client = client;
+         cb (cb_cls, GNUNET_SYSERR);
+         return;
        }
+      GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES);
+      h->client = client;
+    }
+  if (0 == strcasecmp ("arm", service_name))
+    {
       arm_shutdown_ctx = GNUNET_malloc(sizeof(struct ARM_ShutdownContext));
       arm_shutdown_ctx->cb = cb;
       arm_shutdown_ctx->cb_cls = cb_cls;
index 8eb3847c493a57cbb4665901612999cf375f423a..a5599105097bae50b1ac157169299464c9f579e5 100644 (file)
@@ -571,8 +571,6 @@ void stop_listening (const char *serviceName)
           (strcmp (pos->serviceName, serviceName) != 0) )
        continue;
       GNUNET_SCHEDULER_cancel (scheduler, pos->acceptTask);
-      fprintf (stderr, "Closing listening socket %p\n", 
-              pos->listeningSocket);
       GNUNET_NETWORK_socket_close (pos->listeningSocket);
       GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
                                   serviceListeningInfoList_tail, 
@@ -623,8 +621,6 @@ acceptConnection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                       serviceListeningInfo);
       return;
     }
-  fprintf (stderr, "Closing listening socket %p\n", 
-          serviceListeningInfo->listeningSocket);
   GNUNET_NETWORK_socket_close (serviceListeningInfo->listeningSocket);
   GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
                               serviceListeningInfoList_tail, 
@@ -660,13 +656,9 @@ createListeningSocket (struct sockaddr *sa,
     {
     case AF_INET:
       sock = GNUNET_NETWORK_socket_create (PF_INET, SOCK_STREAM, 0);
-      fprintf (stderr, "IPv4 listening at %p\n", 
-              sock);
       break;
     case AF_INET6:
       sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
-      fprintf (stderr, "IPv6 listening at %p\n", 
-              sock);
       break;
     default:
       sock = NULL;
index 2de957ba94ccf756a56938a69d76d6c5ff978aa1..fbc6b04ba74da4f7d1a9fdb807739d9f049b6ac9 100644 (file)
@@ -41,13 +41,12 @@ run (void *cls,
 
 int main(int argc, char *const *argv)
 {
-       int ret;
-
-       ret = (GNUNET_OK ==
-          GNUNET_SERVICE_run (argc,
+  int ret;
+  
+  ret = (GNUNET_OK ==
+        GNUNET_SERVICE_run (argc,
                              argv,
                              "do-nothing", GNUNET_SERVICE_OPTION_NONE,
-                             &run, NULL)) ? 0 : 1;
-       
-       return ret;
+                             &run, NULL)) ? 0 : 1;  
+  return ret;
 }
index adfab9b8f2744954a98f13252823f605ada81f13..17a8ac613e4265b84848c922731a55f152761b24 100644 (file)
@@ -6,7 +6,7 @@ DEFAULTCONFIG = test_arm_api_data.conf
 PORT = 23354
 DEFAULTSERVICES =
 BINARY = gnunet-service-arm
-OPTIONS = -L DEBUG
+OPTIONS = -L ERROR
 #DEBUG = YES
 
 [resolver]
index 357a5e71a16bb4203de4ad77b6dc3d090afaf0b6..8657563fc3b2f7f3bf23bf442f0a7c347b7a4a1f 100644 (file)
@@ -147,17 +147,20 @@ kill_task (void *cbData,
 {
   static struct GNUNET_CLIENT_Connection * doNothingConnection = NULL;
 
-  if (NULL != cbData) {
-    waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
-
+  if (NULL != cbData) 
+    {
+      waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
+      
 #if LOG_BACKOFF
-    fprintf(killLogFilePtr, 
-           "Waited for: %llu ms\n", 
-           (unsigned long long) waitedFor.value);
+      fprintf(killLogFilePtr, 
+             "Waited for: %llu ms\n", 
+             (unsigned long long) waitedFor.value);
 #endif
-  }
+    }
   else
-    waitedFor.value = 0;
+    {
+      waitedFor.value = 0;
+    }
   /* Connect to the doNothing task */
   doNothingConnection = GNUNET_CLIENT_connect (sched, "do-nothing", cfg);
 #if LOG_BACKOFF
@@ -175,8 +178,10 @@ kill_task (void *cbData,
   }
   
   /* Use the created connection to kill the doNothingTask */
-  GNUNET_CLIENT_service_shutdown(sched, doNothingConnection, TIMEOUT, &shutdown_cont, NULL);
-
+  GNUNET_CLIENT_service_shutdown(sched,
+                                doNothingConnection, 
+                                TIMEOUT, 
+                                &shutdown_cont, NULL);
 }
 
        
index 9878dca1731235f90b828706d0ede1ed9bd54999..454fa0e9875cf49e0ddcb5041594ed656628d646 100644 (file)
@@ -38,7 +38,7 @@
 
 #define START_ARM GNUNET_YES
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 static int ret = 1;
 
index 588957d85a9b230ea8d8c6def5c029d6efbc624f..55eb68d13ca2f58cdc2a584c1b7a810f56517b85 100644 (file)
@@ -602,8 +602,8 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg)
   if ((msg == NULL) && (shutdown_ctx->confirmed != GNUNET_YES))   
     {
       /* Means the other side closed the connection and never confirmed a shutdown */
-      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 
-                "Service handle shutdown before ACK!\n");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 
+                 "Service handle shutdown before ACK!\n");
       if (shutdown_ctx->cont != NULL)
         shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR);      
       GNUNET_SCHEDULER_cancel(shutdown_ctx->sched, shutdown_ctx->cancel_task);
@@ -612,7 +612,8 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg)
     }
   else if ((msg == NULL) && (shutdown_ctx->confirmed == GNUNET_YES))
     {
-      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Service shutdown complete.\n");
+      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 
+                "Service shutdown complete.\n");
       if (shutdown_ctx->cont != NULL)
         shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_NO);
 
index 2c2e7d8dfe6061f885889e2395ebe0b4ff2321d4..2214efe108d2edb44a7232db9ff336a61c7ebcbd 100644 (file)
@@ -628,7 +628,6 @@ handle_shutdown (void *cls,
 {
   struct GNUNET_SERVICE_Context *service = cls;
 
-  /* FIXME: why is this call necessary???? */
   GNUNET_SERVER_client_keep(client);
   if (!service->allow_shutdown)
     {