sessiond: make home_ssids and bearer_settle settable
A policy field with no verb behind it is unreachable. set_policy takes both, get_policy reports both, and a zero settling window is refused the same way a zero lock-ack budget is - it is the event-speed controller by another name.
This commit is contained in:
parent
4fd3d244ab
commit
f6479c98a1
2 changed files with 30 additions and 0 deletions
|
|
@ -345,6 +345,17 @@ pub enum Request {
|
|||
lock_ack_budget_secs: Option<u64>,
|
||||
/// Seconds; `Some(0)` means never blank an unlocked session here.
|
||||
unlocked_blank_after_secs: Option<u64>,
|
||||
/// The SSIDs that are the home LAN. Replaces the list wholesale;
|
||||
/// `Some([])` means "never claim to be home", which is the safe
|
||||
/// default rather than an erasure.
|
||||
///
|
||||
/// Identity, never a prefix. The gate this replaces tested
|
||||
/// `inet 10.10.` and read a foreign `10.10.30.0/24` as home.
|
||||
home_ssids: Option<Vec<String>>,
|
||||
/// Seconds a changed bearer preference must hold before it is acted
|
||||
/// on. Never 0: a window of zero is the event-speed controller that
|
||||
/// recycled the tunnel 652 times.
|
||||
bearer_settle_secs: Option<u64>,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1177,6 +1177,8 @@ fn handle_request(
|
|||
"lock_ack_budget_secs": p.lock_ack_budget.as_secs(),
|
||||
"unlocked_blank_after_secs":
|
||||
p.unlocked_blank_after.map(|v| v.as_secs()).unwrap_or(0),
|
||||
"home_ssids": p.home_ssids,
|
||||
"bearer_settle_secs": p.bearer_settle.as_secs(),
|
||||
})
|
||||
}
|
||||
Request::SetPolicy {
|
||||
|
|
@ -1187,6 +1189,8 @@ fn handle_request(
|
|||
dim_warning,
|
||||
lock_ack_budget_secs,
|
||||
unlocked_blank_after_secs,
|
||||
home_ssids,
|
||||
bearer_settle_secs,
|
||||
} => {
|
||||
// 0 means "never" — the desk-clock case, and iOS's Auto-Lock has
|
||||
// the same option for the same reason.
|
||||
|
|
@ -1226,6 +1230,21 @@ fn handle_request(
|
|||
if let Some(v) = unlocked_blank_after_secs {
|
||||
p.unlocked_blank_after = as_budget(v);
|
||||
}
|
||||
if let Some(v) = home_ssids {
|
||||
p.home_ssids = v;
|
||||
}
|
||||
// Zero is the event-speed controller this whole mechanism exists
|
||||
// to not be. Refuse it the same way a zero ack budget is refused.
|
||||
if let Some(v) = bearer_settle_secs {
|
||||
if v == 0 {
|
||||
drop(d);
|
||||
return refuse(
|
||||
RefusalCode::InvalidArgument,
|
||||
"bearer_settle_secs must be at least 1",
|
||||
);
|
||||
}
|
||||
p.bearer_settle = Duration::from_secs(v);
|
||||
}
|
||||
// A dim warning longer than the budget it warns about is not a
|
||||
// warning — `dim_at` saturates to zero and the panel dims the
|
||||
// instant it goes idle, with no lit period at all. Refuse rather
|
||||
|
|
|
|||
Loading…
Reference in a new issue