aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 5b355b2e1..8f1c8e876 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -1,10 +1,10 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2006, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2006-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your 7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
@@ -26,17 +26,15 @@
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_common.h" 28#include "gnunet_common.h"
29#include "gnunet_crypto_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_strings_lib.h"
31#include "gnunet_time_lib.h"
32
33#include <regex.h> 30#include <regex.h>
34 31
32
35/** 33/**
36 * After how many milliseconds do we always print 34 * After how many milliseconds do we always print
37 * that "message X was repeated N times"? Use 12h. 35 * that "message X was repeated N times"? Use 12h.
38 */ 36 */
39#define BULK_DELAY_THRESHOLD (12 * 60 * 60 * 1000) 37#define BULK_DELAY_THRESHOLD (12 * 60 * 60 * 1000LL * 1000LL)
40 38
41/** 39/**
42 * After how many repetitions do we always print 40 * After how many repetitions do we always print
@@ -800,7 +798,7 @@ flush_bulk (const char *datestr)
800 char *last; 798 char *last;
801 const char *ft; 799 const char *ft;
802 800
803 if ((last_bulk_time.abs_value == 0) || (last_bulk_repeat == 0)) 801 if ((0 == last_bulk_time.abs_value_us) || (0 == last_bulk_repeat))
804 return; 802 return;
805 rev = 0; 803 rev = 0;
806 last = memchr (last_bulk, '\0', BULK_TRACK_SIZE); 804 last = memchr (last_bulk, '\0', BULK_TRACK_SIZE);
@@ -951,12 +949,13 @@ mylog (enum GNUNET_ErrorType kind, const char *comp, const char *message,
951 if (NULL != tmptr) 949 if (NULL != tmptr)
952 (void) setup_log_file (tmptr); 950 (void) setup_log_file (tmptr);
953 if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) && 951 if ((0 != (kind & GNUNET_ERROR_TYPE_BULK)) &&
954 (last_bulk_time.abs_value != 0) && 952 (0 != last_bulk_time.abs_value_us) &&
955 (0 == strncmp (buf, last_bulk, sizeof (last_bulk)))) 953 (0 == strncmp (buf, last_bulk, sizeof (last_bulk))))
956 { 954 {
957 last_bulk_repeat++; 955 last_bulk_repeat++;
958 if ((GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value > 956 if ( (GNUNET_TIME_absolute_get_duration (last_bulk_time).rel_value_us >
959 BULK_DELAY_THRESHOLD) || (last_bulk_repeat > BULK_REPEAT_THRESHOLD)) 957 BULK_DELAY_THRESHOLD) ||
958 (last_bulk_repeat > BULK_REPEAT_THRESHOLD) )
960 flush_bulk (date); 959 flush_bulk (date);
961 return; 960 return;
962 } 961 }