gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10525 - gnunet/src/arm


From: gnunet
Subject: [GNUnet-SVN] r10525 - gnunet/src/arm
Date: Tue, 9 Mar 2010 17:26:52 +0100

Author: grothoff
Date: 2010-03-09 17:26:52 +0100 (Tue, 09 Mar 2010)
New Revision: 10525

Modified:
   gnunet/src/arm/test_exponential_backoff.c
Log:
nolog

Modified: gnunet/src/arm/test_exponential_backoff.c
===================================================================
--- gnunet/src/arm/test_exponential_backoff.c   2010-03-08 20:44:13 UTC (rev 
10524)
+++ gnunet/src/arm/test_exponential_backoff.c   2010-03-09 16:26:52 UTC (rev 
10525)
@@ -29,6 +29,7 @@
 
 #define VERBOSE GNUNET_NO
 #define START_ARM GNUNET_YES
+#define LOG_BACKOFF GNUNET_NO
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
 #define SERVICE_TEST_TIMEOUT GNUNET_TIME_UNIT_FOREVER_REL
 #define FIVE_MILLISECONDS GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_MILLISECONDS, 5)
@@ -37,8 +38,11 @@
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 static struct GNUNET_ARM_Handle *arm;
 static int ok = 1;
+
+#if LOG_BACKOFF
 static FILE *killLogFilePtr;
 static char *killLogFileName;
+#endif
 
 
 static void
@@ -89,22 +93,27 @@
   static int trialCount = 0;
   
   trialCount++;
-  
-  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) { 
-    fprintf(killLogFilePtr, 
-           "%d.Reason is shutdown!\n",
-           trialCount);
-  }
-  else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) {
-    fprintf(killLogFilePtr, 
-           "%d.Reason is timeout!\n", 
-           trialCount);
-  }
-  else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) {
-    fprintf(killLogFilePtr, 
-           "%d.Service is running!\n", 
-           trialCount);
-  }  
+
+#if LOG_BACKOFF  
+  if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) 
+    {
+      fprintf(killLogFilePtr, 
+             "%d.Reason is shutdown!\n",
+             trialCount);
+    } 
+  else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) 
+    {
+      fprintf(killLogFilePtr, 
+             "%d.Reason is timeout!\n", 
+             trialCount);
+    }
+  else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0) 
+    {
+      fprintf(killLogFilePtr, 
+             "%d.Service is running!\n", 
+             trialCount);
+    }  
+#endif
   GNUNET_SCHEDULER_add_now (sched, &kill_task, &a);
 }
 
@@ -130,18 +139,21 @@
   
   if (NULL != cbData) {
     waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
+#if LOG_BACKOFF
     fprintf(killLogFilePtr, 
-           "Waited for: %llu ms\n\n", 
+           "Waited for: %llu ms\n", 
            (unsigned long long) waitedFor.value);
+#endif
   }
   else
     waitedFor.value = 0;
   /* Connect to the doNothing task */
   doNothingConnection = GNUNET_CLIENT_connect (sched, "do-nothing", cfg);
+#if LOG_BACKOFF
   if (NULL == doNothingConnection)
     fprintf(killLogFilePtr, 
            "Unable to connect to do-nothing process!\n");
-  
+#endif  
   if (trialCount == 12) {
     GNUNET_ARM_stop_service (arm, 
                             "do-nothing", 
@@ -209,12 +221,14 @@
 static int
 init()
 {
+#if LOG_BACKOFF
   killLogFileName = GNUNET_DISK_mktemp("exponential-backoff-waiting.log");
   if (NULL == (killLogFilePtr = FOPEN(killLogFileName, "w"))) {
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fopen", 
killLogFileName);
     GNUNET_free (killLogFileName);
     return GNUNET_SYSERR;
   }  
+#endif
   return GNUNET_OK;
 }
 
@@ -222,8 +236,10 @@
 static void
 houseKeep()
 {
+#if LOG_BACKOFF
   GNUNET_assert (0 == fclose (killLogFilePtr));
   GNUNET_free(killLogFileName);
+#endif
 }
 
 





reply via email to

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