small update adding types - fixes error[E0283]

This commit is contained in:
Debanjan Basu 2025-03-24 19:14:59 +11:00
parent fbf169019e
commit 35e60d9cfb

View File

@ -81,24 +81,22 @@ impl AttachmentManager {
health: &RoutingTableHealth,
config: &VeilidConfigRoutingTable,
) -> AttachmentState {
if health.reliable_entry_count >= config.limit_over_attached.try_into().unwrap() {
return AttachmentState::OverAttached;
let reliable = health.reliable_entry_count;
let weak_limit = config.limit_attached_weak as usize;
if reliable >= config.limit_over_attached as usize {
AttachmentState::OverAttached
} else if reliable >= config.limit_fully_attached as usize {
AttachmentState::FullyAttached
} else if reliable >= config.limit_attached_strong as usize {
AttachmentState::AttachedStrong
} else if reliable >= config.limit_attached_good as usize {
AttachmentState::AttachedGood
} else if reliable >= weak_limit || health.unreliable_entry_count >= weak_limit {
AttachmentState::AttachedWeak
} else {
AttachmentState::Attaching
}
if health.reliable_entry_count >= config.limit_fully_attached.try_into().unwrap() {
return AttachmentState::FullyAttached;
}
if health.reliable_entry_count >= config.limit_attached_strong.try_into().unwrap() {
return AttachmentState::AttachedStrong;
}
if health.reliable_entry_count >= config.limit_attached_good.try_into().unwrap() {
return AttachmentState::AttachedGood;
}
if health.reliable_entry_count >= config.limit_attached_weak.try_into().unwrap()
|| health.unreliable_entry_count >= config.limit_attached_weak.try_into().unwrap()
{
return AttachmentState::AttachedWeak;
}
AttachmentState::Attaching
}
/// Update attachment and network readiness state