mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
Remember specified rate limit
This commit is contained in:
parent
eb08cf27ce
commit
55db779f8c
@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#define INTERFACE_STATE_DETECTING 2
|
||||
|
||||
struct limit_state{
|
||||
uint32_t rate_micro_seconds;
|
||||
// length of time for a burst
|
||||
time_ms_t burst_length;
|
||||
// how many in a burst
|
||||
@ -40,7 +41,7 @@ struct limit_state{
|
||||
|
||||
time_ms_t limit_next_allowed(struct limit_state *state);
|
||||
int limit_is_allowed(struct limit_state *state);
|
||||
int limit_init(struct limit_state *state, int rate_micro_seconds);
|
||||
int limit_init(struct limit_state *state, uint32_t rate_micro_seconds);
|
||||
|
||||
struct overlay_interface;
|
||||
|
||||
|
@ -69,7 +69,8 @@ int limit_is_allowed(struct limit_state *state){
|
||||
}
|
||||
|
||||
/* Initialise burst size and length based on the number we can do in one MIN_BURST */
|
||||
int limit_init(struct limit_state *state, int rate_micro_seconds){
|
||||
int limit_init(struct limit_state *state, uint32_t rate_micro_seconds){
|
||||
state->rate_micro_seconds = rate_micro_seconds;
|
||||
if (rate_micro_seconds==0){
|
||||
state->burst_size=0;
|
||||
state->burst_length=1;
|
||||
|
Loading…
Reference in New Issue
Block a user