summaryrefslogtreecommitdiff
path: root/src/feature/stats/rephist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/feature/stats/rephist.c')
-rw-r--r--src/feature/stats/rephist.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c
index 4ad5d46b0c..e25c01331d 100644
--- a/src/feature/stats/rephist.c
+++ b/src/feature/stats/rephist.c
@@ -221,23 +221,34 @@ overload_happened_recently(time_t overload_time, int n_hours)
/* The current version of the overload stats version */
#define OVERLOAD_STATS_VERSION 1
-/** Returns an allocated string for extra-info documents for publishing
- * overload statistics. */
+/** Returns an allocated string for server descriptor for publising information
+ * on whether we are overloaded or not. */
char *
-rep_hist_get_overload_stats_lines(void)
+rep_hist_get_overload_general_line(void)
{
char *result = NULL;
- smartlist_t *chunks = smartlist_new();
char tbuf[ISO_TIME_LEN+1];
- /* First encode the general overload */
+ /* Encode the general overload */
if (overload_happened_recently(overload_stats.overload_general_time, 72)) {
format_iso_time(tbuf, overload_stats.overload_general_time);
- smartlist_add_asprintf(chunks, "overload-general %d %s\n",
- OVERLOAD_STATS_VERSION, tbuf);
+ tor_asprintf(&result, "overload-general %d %s\n",
+ OVERLOAD_STATS_VERSION, tbuf);
}
- /* Now do bandwidth-related overloads */
+ return result;
+}
+
+/** Returns an allocated string for extra-info documents for publishing
+ * overload statistics. */
+char *
+rep_hist_get_overload_stats_lines(void)
+{
+ char *result = NULL;
+ smartlist_t *chunks = smartlist_new();
+ char tbuf[ISO_TIME_LEN+1];
+
+ /* Add bandwidth-related overloads */
if (overload_happened_recently(overload_stats.overload_ratelimits_time,24)) {
const or_options_t *options = get_options();
format_iso_time(tbuf, overload_stats.overload_ratelimits_time);