mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 22:47:12 +01:00
pass bucket sizes num_read and num_written around as size_ts
rather than ints svn:r13610
This commit is contained in:
parent
f2ed011813
commit
1c8bd320be
3 changed files with 8 additions and 7 deletions
|
@ -1571,7 +1571,7 @@ global_write_bucket_low(connection_t *conn, size_t attempt, int priority)
|
|||
* Decrement buckets appropriately. */
|
||||
static void
|
||||
connection_buckets_decrement(connection_t *conn, time_t now,
|
||||
int num_read, int num_written)
|
||||
size_t num_read, size_t num_written)
|
||||
{
|
||||
if (!connection_is_rate_limited(conn))
|
||||
return; /* local IPs are free */
|
||||
|
|
|
@ -3556,8 +3556,8 @@ void rep_hist_note_extend_succeeded(const char *from_name,
|
|||
const char *to_name);
|
||||
void rep_hist_note_extend_failed(const char *from_name, const char *to_name);
|
||||
void rep_hist_dump_stats(time_t now, int severity);
|
||||
void rep_hist_note_bytes_read(int num_bytes, time_t when);
|
||||
void rep_hist_note_bytes_written(int num_bytes, time_t when);
|
||||
void rep_hist_note_bytes_read(size_t num_bytes, time_t when);
|
||||
void rep_hist_note_bytes_written(size_t num_bytes, time_t when);
|
||||
int rep_hist_bandwidth_assess(void);
|
||||
char *rep_hist_get_bandwidth_lines(int for_extrainfo);
|
||||
void rep_hist_update_state(or_state_t *state);
|
||||
|
|
|
@ -1056,7 +1056,8 @@ advance_obs(bw_array_t *b)
|
|||
commit_max(b);
|
||||
}
|
||||
|
||||
/** Add 'n' bytes to the number of bytes in b for second 'when'. */
|
||||
/** Add <b>n</b> bytes to the number of bytes in <b>b</b> for second
|
||||
* <b>when</b>. */
|
||||
static INLINE void
|
||||
add_obs(bw_array_t *b, time_t when, uint64_t n)
|
||||
{
|
||||
|
@ -1106,7 +1107,7 @@ bw_arrays_init(void)
|
|||
* earlier than the latest <b>when</b> you've heard of.
|
||||
*/
|
||||
void
|
||||
rep_hist_note_bytes_written(int num_bytes, time_t when)
|
||||
rep_hist_note_bytes_written(size_t num_bytes, time_t when)
|
||||
{
|
||||
/* Maybe a circular array for recent seconds, and step to a new point
|
||||
* every time a new second shows up. Or simpler is to just to have
|
||||
|
@ -1123,7 +1124,7 @@ rep_hist_note_bytes_written(int num_bytes, time_t when)
|
|||
* (like rep_hist_note_bytes_written() above)
|
||||
*/
|
||||
void
|
||||
rep_hist_note_bytes_read(int num_bytes, time_t when)
|
||||
rep_hist_note_bytes_read(size_t num_bytes, time_t when)
|
||||
{
|
||||
/* if we're smart, we can make this func and the one above share code */
|
||||
add_obs(read_array, when, num_bytes);
|
||||
|
@ -1148,7 +1149,7 @@ find_largest_max(bw_array_t *b)
|
|||
|
||||
/** Find the largest sums in the past NUM_SECS_BW_SUM_IS_VALID (roughly)
|
||||
* seconds. Find one sum for reading and one for writing. They don't have
|
||||
* to be at the same time).
|
||||
* to be at the same time.
|
||||
*
|
||||
* Return the smaller of these sums, divided by NUM_SECS_ROLLING_MEASURE.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue