gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7350 - GNUnet/src/util/error


From: gnunet
Subject: [GNUnet-SVN] r7350 - GNUnet/src/util/error
Date: Fri, 27 Jun 2008 13:16:01 -0600 (MDT)

Author: grothoff
Date: 2008-06-27 13:16:01 -0600 (Fri, 27 Jun 2008)
New Revision: 7350

Modified:
   GNUnet/src/util/error/error.c
Log:
better

Modified: GNUnet/src/util/error/error.c
===================================================================
--- GNUnet/src/util/error/error.c       2008-06-27 19:03:38 UTC (rev 7349)
+++ GNUnet/src/util/error/error.c       2008-06-27 19:16:01 UTC (rev 7350)
@@ -129,25 +129,33 @@
           const char * datestr)
 {
   char msg[DATE_STR_SIZE + BULK_TRACK_SIZE + 256];
+  GNUNET_CronTime now;
+  int rev;
 
-  if (ctx->last_bulk_time == 0)
+  if ( (ctx->last_bulk_time == 0) ||
+       (ctx->last_bulk_repeat == 0) )
     return;
+  now = GNUNET_get_time();
+  rev = 0;
   if (ctx->last_bulk[strnlen(ctx->last_bulk, BULK_TRACK_SIZE)-1] == '\n') 
-    ctx->last_bulk[strnlen(ctx->last_bulk, BULK_TRACK_SIZE)-1] = '\0';
-
+    {
+      rev = 1;
+      ctx->last_bulk[strnlen(ctx->last_bulk, BULK_TRACK_SIZE)-1] = '\0';
+    }
   snprintf(msg,
           sizeof(msg),
-          _("%s Message `%.*s' repeated %u times in the last %llus\n"),
-          datestr,
+          _("Message `%.*s' repeated %u times in the last %llus\n"),
           BULK_TRACK_SIZE,
           ctx->last_bulk,
           ctx->last_bulk_repeat,
-          (GNUNET_get_time() - ctx->last_bulk_time) / GNUNET_CRON_SECONDS);
+          (now - ctx->last_bulk_time) / GNUNET_CRON_SECONDS);
+  if (rev == 1)
+    ctx->last_bulk[strnlen(ctx->last_bulk, BULK_TRACK_SIZE-1)] = '\n';
   if (ctx != NULL)
     ctx->handler (ctx->cls, ctx->last_bulk_kind, datestr, msg);
   else
     fprintf (stderr, "%s %s", datestr, msg);
-  ctx->last_bulk_time = 0;
+  ctx->last_bulk_time = now;
   ctx->last_bulk_repeat = 0;
 }
 
@@ -214,7 +222,10 @@
     }
   if ( (now - ctx->last_bulk_time > BULK_DELAY_THRESHOLD) ||
        (ctx->last_bulk_repeat > BULK_REPEAT_THRESHOLD) )
-    flush_bulk(ctx, date);
+    {
+      flush_bulk(ctx, date);
+      ctx->last_bulk_time = 0;
+    }
   if (ctx != NULL)
     ctx->handler (ctx->cls, kind, date, buf);
   else





reply via email to

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