mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
cmux: Rename cell_ewma_set_scale_factor()
It is rename to something more meaningful that explains what it does exactly which is sets the EWMA options (currently only one exists). The new name is cmux_ewma_set_options(). Also, remove a public function from circuitmux_ewma.h that is only used in the C file. Make it static inline as well. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
6b1dba214d
commit
9af5b625e8
@ -241,6 +241,13 @@ circuitmux_policy_t ewma_policy = {
|
|||||||
|
|
||||||
/*** EWMA method implementations using the below EWMA helper functions ***/
|
/*** EWMA method implementations using the below EWMA helper functions ***/
|
||||||
|
|
||||||
|
/** Compute and return the current cell_ewma tick. */
|
||||||
|
static inline unsigned int
|
||||||
|
cell_ewma_get_tick(void)
|
||||||
|
{
|
||||||
|
return ((unsigned)approx_time() / EWMA_TICK_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate an ewma_policy_data_t and upcast it to a circuitmux_policy_data_t;
|
* Allocate an ewma_policy_data_t and upcast it to a circuitmux_policy_data_t;
|
||||||
* this is called when setting the policy on a circuitmux_t to ewma_policy.
|
* this is called when setting the policy on a circuitmux_t to ewma_policy.
|
||||||
@ -610,13 +617,6 @@ cell_ewma_tick_from_timeval(const struct timeval *now,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compute and return the current cell_ewma tick. */
|
|
||||||
unsigned int
|
|
||||||
cell_ewma_get_tick(void)
|
|
||||||
{
|
|
||||||
return ((unsigned)approx_time() / EWMA_TICK_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default value for the CircuitPriorityHalflifeMsec consensus parameter in
|
/* Default value for the CircuitPriorityHalflifeMsec consensus parameter in
|
||||||
* msec. */
|
* msec. */
|
||||||
#define CMUX_PRIORITY_HALFLIFE_MSEC_DEFAULT 30000
|
#define CMUX_PRIORITY_HALFLIFE_MSEC_DEFAULT 30000
|
||||||
@ -672,8 +672,8 @@ get_circuit_priority_halflife(const or_options_t *options,
|
|||||||
|
|
||||||
/** Adjust the global cell scale factor based on <b>options</b> */
|
/** Adjust the global cell scale factor based on <b>options</b> */
|
||||||
void
|
void
|
||||||
cell_ewma_set_scale_factor(const or_options_t *options,
|
cmux_ewma_set_options(const or_options_t *options,
|
||||||
const networkstatus_t *consensus)
|
const networkstatus_t *consensus)
|
||||||
{
|
{
|
||||||
double halflife;
|
double halflife;
|
||||||
const char *source;
|
const char *source;
|
||||||
|
@ -12,12 +12,12 @@
|
|||||||
#include "or.h"
|
#include "or.h"
|
||||||
#include "circuitmux.h"
|
#include "circuitmux.h"
|
||||||
|
|
||||||
|
/* The public EWMA policy callbacks object. */
|
||||||
extern circuitmux_policy_t ewma_policy;
|
extern circuitmux_policy_t ewma_policy;
|
||||||
|
|
||||||
/* Externally visible EWMA functions */
|
/* Externally visible EWMA functions */
|
||||||
unsigned int cell_ewma_get_tick(void);
|
void cmux_ewma_set_options(const or_options_t *options,
|
||||||
void cell_ewma_set_scale_factor(const or_options_t *options,
|
const networkstatus_t *consensus);
|
||||||
const networkstatus_t *consensus);
|
|
||||||
|
|
||||||
#endif /* !defined(TOR_CIRCUITMUX_EWMA_H) */
|
#endif /* !defined(TOR_CIRCUITMUX_EWMA_H) */
|
||||||
|
|
||||||
|
@ -2073,7 +2073,7 @@ options_act(const or_options_t *old_options)
|
|||||||
configure_accounting(time(NULL));
|
configure_accounting(time(NULL));
|
||||||
|
|
||||||
/* Change the cell EWMA settings */
|
/* Change the cell EWMA settings */
|
||||||
cell_ewma_set_scale_factor(options, networkstatus_get_latest_consensus());
|
cmux_ewma_set_options(options, networkstatus_get_latest_consensus());
|
||||||
|
|
||||||
/* Update the BridgePassword's hashed version as needed. We store this as a
|
/* Update the BridgePassword's hashed version as needed. We store this as a
|
||||||
* digest so that we can do side-channel-proof comparisons on it.
|
* digest so that we can do side-channel-proof comparisons on it.
|
||||||
|
@ -2003,7 +2003,7 @@ networkstatus_set_current_consensus(const char *consensus,
|
|||||||
update_consensus_networkstatus_fetch_time(now);
|
update_consensus_networkstatus_fetch_time(now);
|
||||||
|
|
||||||
/* Change the cell EWMA settings */
|
/* Change the cell EWMA settings */
|
||||||
cell_ewma_set_scale_factor(options, c);
|
cmux_ewma_set_options(options, c);
|
||||||
|
|
||||||
/* XXXX this call might be unnecessary here: can changing the
|
/* XXXX this call might be unnecessary here: can changing the
|
||||||
* current consensus really alter our view of any OR's rate limits? */
|
* current consensus really alter our view of any OR's rate limits? */
|
||||||
|
Loading…
Reference in New Issue
Block a user