mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 21:13:44 +02:00
fixed tests and incorrect rate limit check
This commit is contained in:
parent
4d16a30eac
commit
e1e73975fe
2 changed files with 3 additions and 3 deletions
|
@ -209,7 +209,7 @@ mod tests {
|
|||
)
|
||||
.is_ok());
|
||||
}
|
||||
if (test_loop % 8) == 0 && test_loop >= 8 && host.this_name.eq("alice") {
|
||||
if (test_loop % 8) == 0 && test_loop >= 8 {
|
||||
session.service(host, send_to_other, &[], mtu_buffer.len(), test_loop as i64, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ impl<Application: ApplicationLayer> ReceiveContext<Application> {
|
|||
|
||||
// Check rate limits.
|
||||
if let Some(session) = session.as_ref() {
|
||||
if (current_time - session.state.read().unwrap().last_remote_offer) < Application::REKEY_RATE_LIMIT_MS {
|
||||
if current_time < session.state.read().unwrap().last_remote_offer + Application::REKEY_RATE_LIMIT_MS {
|
||||
return Err(Error::RateLimited);
|
||||
}
|
||||
} else {
|
||||
|
@ -867,7 +867,7 @@ impl<Application: ApplicationLayer> ReceiveContext<Application> {
|
|||
if let Some(k) = state.session_keys[key_id as usize].as_ref() {
|
||||
if k.role == Role::Bob {
|
||||
// The local party is not allowed to be Bob twice in a row
|
||||
// this prevents rekeying failure from both parties attempting to rekey at the same time
|
||||
// This prevents rekeying failure from both parties attempting to rekey at the same time
|
||||
return Ok(ReceiveResult::Ignored);
|
||||
}
|
||||
if public_fingerprint_of_secret(k.ratchet_key.as_bytes())[..16].eq(alice_ratchet_key_fingerprint) {
|
||||
|
|
Loading…
Add table
Reference in a new issue