Merge remote-tracking branch 'dgoulet/ticket24902_029_05'

This commit is contained in:
Nick Mathewson 2018-02-05 11:38:58 -05:00
commit f0d7905bc9
2 changed files with 2 additions and 4 deletions

View File

@ -308,8 +308,6 @@ cc_stats_refill_bucket(cc_client_stats_t *stats, const tor_addr_t *addr)
new_circuit_bucket_count = MIN(stats->circuit_bucket + (uint32_t)num_token, new_circuit_bucket_count = MIN(stats->circuit_bucket + (uint32_t)num_token,
dos_cc_circuit_burst); dos_cc_circuit_burst);
} }
/* This function is not allowed to make the bucket count smaller */
tor_assert_nonfatal(new_circuit_bucket_count >= stats->circuit_bucket);
log_debug(LD_DOS, "DoS address %s has its circuit bucket value: %" PRIu32 log_debug(LD_DOS, "DoS address %s has its circuit bucket value: %" PRIu32
". Filling it to %" PRIu32 ". Circuit rate is %" PRIu64 ". Filling it to %" PRIu32 ". Circuit rate is %" PRIu64
". Elapsed time is %" PRIi64, ". Elapsed time is %" PRIi64,

View File

@ -179,8 +179,8 @@ test_dos_bucket_refill(void *arg)
uint64_t circ_rate = get_circuit_rate_per_second(); uint64_t circ_rate = get_circuit_rate_per_second();
/* Check that the circuit rate is a positive number and smaller than the max /* Check that the circuit rate is a positive number and smaller than the max
* circuit count */ * circuit count */
tt_int_op(circ_rate, OP_GT, 1); tt_u64_op(circ_rate, OP_GT, 1);
tt_int_op(circ_rate, OP_LT, max_circuit_count); tt_u64_op(circ_rate, OP_LT, max_circuit_count);
/* Register this client */ /* Register this client */
geoip_note_client_seen(GEOIP_CLIENT_CONNECT, addr, NULL, now); geoip_note_client_seen(GEOIP_CLIENT_CONNECT, addr, NULL, now);