#include "router.h"
#include "circuitlist.h"
#include "main.h"
+#include "rephist.h"
+#include "hibernate.h"
+#include "rephist.h"
+#include "statefile.h"
+
+static void log_accounting(const time_t now, const or_options_t *options);
+ #include "geoip.h"
/** Return the total number of circuits. */
-static int
+STATIC int
count_circuits(void)
{
- circuit_t *circ;
- int nr=0;
-
- for (circ = circuit_get_global_list_(); circ; circ = circ->next)
- nr++;
-
- return nr;
+ return smartlist_len(circuit_get_global_list());
}
/** Take seconds <b>secs</b> and return a newly allocated human-readable
char *bw_rcvd = NULL;
char *uptime = NULL;
const routerinfo_t *me;
+ double r = tls_get_write_overhead_ratio();
+ const int hibernating = we_are_hibernating();
const or_options_t *options = get_options();
- (void)now;
- if (public_server_mode(options)) {
+ if (public_server_mode(options) && !hibernating) {
/* Let's check if we are in the current cached consensus. */
if (!(me = router_get_my_routerinfo()))
return -1; /* Something stinks, we won't even attempt this. */
100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
+ if (r > 1.0) {
+ double overhead = ( r - 1.0 ) * 100.0;
+ log_notice(LD_HEARTBEAT, "TLS write overhead: %.f%%", overhead);
+ }
+
+ if (public_server_mode(options))
+ rep_hist_log_circuit_handshake_stats(now);
+
+ circuit_log_ancient_one_hop_circuits(1800);
+
+ if (options->BridgeRelay) {
+ char *msg = NULL;
+ msg = format_client_stats_heartbeat(now);
+ if (msg)
+ log_notice(LD_HEARTBEAT, "%s", msg);
+ tor_free(msg);
+ }
+
tor_free(uptime);
tor_free(bw_sent);
tor_free(bw_rcvd);