gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15096 - gnunet/src/statistics


From: gnunet
Subject: [GNUnet-SVN] r15096 - gnunet/src/statistics
Date: Thu, 28 Apr 2011 10:39:27 +0200

Author: grothoff
Date: 2011-04-28 10:39:27 +0200 (Thu, 28 Apr 2011)
New Revision: 15096

Modified:
   gnunet/src/statistics/Makefile.am
   gnunet/src/statistics/statistics_api.c
   gnunet/src/statistics/test_statistics_api_data.conf
   gnunet/src/statistics/test_statistics_api_watch.c
Log:
fixing 1671

Modified: gnunet/src/statistics/Makefile.am
===================================================================
--- gnunet/src/statistics/Makefile.am   2011-04-28 08:14:26 UTC (rev 15095)
+++ gnunet/src/statistics/Makefile.am   2011-04-28 08:39:27 UTC (rev 15096)
@@ -46,7 +46,8 @@
 
 check_PROGRAMS = \
  test_statistics_api \
- test_statistics_api_loop
+ test_statistics_api_loop \
+ test_statistics_api_watch 
 
 if !DISABLE_TEST_RUN
 TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
@@ -64,6 +65,12 @@
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/util/libgnunetutil.la  
 
+test_statistics_api_watch_SOURCES = \
+ test_statistics_api_watch.c
+test_statistics_api_watch_LDADD = \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(top_builddir)/src/util/libgnunetutil.la  
+
 check_SCRIPTS = \
   test_gnunet_statistics.sh
 

Modified: gnunet/src/statistics/statistics_api.c
===================================================================
--- gnunet/src/statistics/statistics_api.c      2011-04-28 08:14:26 UTC (rev 
15095)
+++ gnunet/src/statistics/statistics_api.c      2011-04-28 08:39:27 UTC (rev 
15096)
@@ -620,6 +620,11 @@
       finish (handle, GNUNET_SYSERR);
       return 0;
     }
+#if DEBUG_STATISTICS
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Transmitting watch request for `%s'\n",
+             handle->current->name);
+#endif
   slen1 = strlen (handle->current->subsystem) + 1;
   slen2 = strlen (handle->current->name) + 1;
   msize = slen1 + slen2 + sizeof (struct GNUNET_MessageHeader);
@@ -633,7 +638,7 @@
                                              2,
                                              handle->current->subsystem,
                                              handle->current->name));
-  if (! handle->receiving)
+  if (GNUNET_YES != handle->receiving)
     {
       handle->receiving = GNUNET_YES;
       GNUNET_CLIENT_receive (handle->client,
@@ -641,6 +646,7 @@
                             handle,
                             GNUNET_TIME_UNIT_FOREVER_REL);
     }
+  finish (handle, GNUNET_OK);
   return msize;
 }
 

Modified: gnunet/src/statistics/test_statistics_api_data.conf
===================================================================
--- gnunet/src/statistics/test_statistics_api_data.conf 2011-04-28 08:14:26 UTC 
(rev 15095)
+++ gnunet/src/statistics/test_statistics_api_data.conf 2011-04-28 08:39:27 UTC 
(rev 15096)
@@ -5,7 +5,7 @@
 [statistics]
 PORT = 22353
 UNIXPATH = /tmp/test-statistics-service-statistics.unix
-DEBUG = NO
+#DEBUG = YES
 
 [arm]
 PORT = 22354

Modified: gnunet/src/statistics/test_statistics_api_watch.c
===================================================================
--- gnunet/src/statistics/test_statistics_api_watch.c   2011-04-28 08:14:26 UTC 
(rev 15095)
+++ gnunet/src/statistics/test_statistics_api_watch.c   2011-04-28 08:39:27 UTC 
(rev 15096)
@@ -29,7 +29,7 @@
 #include "gnunet_scheduler_lib.h"
 #include "gnunet_statistics_service.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define START_SERVICE GNUNET_YES
 
@@ -53,6 +53,14 @@
   ok = 7;
 }
 
+static void
+normal_shutdown (void *cls,
+                const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_STATISTICS_destroy (h, GNUNET_NO);
+  GNUNET_STATISTICS_destroy (h2, GNUNET_NO);
+}
+
 static int
 watch_1 (void *cls, 
         const char *subsystem,
@@ -66,9 +74,8 @@
   ok &= ~1;
   if (0 == ok)
     {
-      GNUNET_STATISTICS_destroy (h, GNUNET_NO);
-      GNUNET_STATISTICS_destroy (h2, GNUNET_NO);
       GNUNET_SCHEDULER_cancel (shutdown_task);
+      GNUNET_SCHEDULER_add_now (&normal_shutdown, NULL);
     }  
   return GNUNET_OK;
 }
@@ -86,9 +93,8 @@
   ok &= ~2;
   if (0 == ok)
     {
-      GNUNET_STATISTICS_destroy (h, GNUNET_NO);
-      GNUNET_STATISTICS_destroy (h2, GNUNET_NO);
       GNUNET_SCHEDULER_cancel (shutdown_task);
+      GNUNET_SCHEDULER_add_now (&normal_shutdown, NULL);
     }  
   return GNUNET_OK;
 }




reply via email to

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