fix runtime issues on ios
This commit is contained in:
parent
68ad22a985
commit
19a71534ec
|
@ -196,8 +196,6 @@ impl<'a> super::Verifier<'a> {
|
|||
return;
|
||||
}
|
||||
|
||||
// mut not used when compiling or iOS
|
||||
#[allow(unused_mut)]
|
||||
let mut forbidden_bits = if !self.readable_okay && path_type == PathType::Final {
|
||||
// If this is the target object, and it must not be readable, then
|
||||
// we forbid it to be group-rwx and all-rwx.
|
||||
|
@ -232,6 +230,13 @@ impl<'a> super::Verifier<'a> {
|
|||
forbidden_bits &= !0o070;
|
||||
}
|
||||
|
||||
// rational: on iOS the platform already protect user data, and not setting this poses
|
||||
// issue with the default application data folder.
|
||||
#[cfg(target_os = "ios")]
|
||||
{
|
||||
forbidden_bits &= !0o070;
|
||||
}
|
||||
|
||||
let bad_bits = meta.mode() & forbidden_bits;
|
||||
if bad_bits != 0 {
|
||||
errors.push(Error::BadPermission(
|
||||
|
|
|
@ -1325,16 +1325,18 @@ impl<B: AbstractCircBuilder + 'static, R: Runtime> AbstractCircMgr<B, R> {
|
|||
/// no longer be given out for new circuits.
|
||||
pub(crate) fn expire_circs(&self, now: Instant) {
|
||||
let mut list = self.circs.lock().expect("poisoned lock");
|
||||
let dirty_cutoff = now - self.circuit_timing().max_dirtiness;
|
||||
list.expire_circs(now, dirty_cutoff);
|
||||
if let Some(dirty_cutoff) = now.checked_sub(self.circuit_timing().max_dirtiness) {
|
||||
list.expire_circs(now, dirty_cutoff);
|
||||
}
|
||||
}
|
||||
|
||||
/// Consider expiring the circuit with given circuit `id`,
|
||||
/// according to the rules in `config` and the current time `now`.
|
||||
pub(crate) fn expire_circ(&self, circ_id: &<B::Circ as AbstractCirc>::Id, now: Instant) {
|
||||
let mut list = self.circs.lock().expect("poisoned lock");
|
||||
let dirty_cutoff = now - self.circuit_timing().max_dirtiness;
|
||||
list.expire_circ(circ_id, now, dirty_cutoff);
|
||||
if let Some(dirty_cutoff) = now.checked_sub(self.circuit_timing().max_dirtiness) {
|
||||
list.expire_circ(circ_id, now, dirty_cutoff);
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the number of open circuits held by this circuit manager.
|
||||
|
|
|
@ -22,9 +22,9 @@ pub(crate) struct SkewObservation {
|
|||
|
||||
impl SkewObservation {
|
||||
/// Return true if this observation has been made more recently than
|
||||
/// `cutoff`.
|
||||
pub(crate) fn more_recent_than(&self, cutoff: Instant) -> bool {
|
||||
self.when > cutoff
|
||||
/// `cutoff`. If cutoff is None, consider it's very far in the past.
|
||||
pub(crate) fn more_recent_than(&self, cutoff: Option<Instant>) -> bool {
|
||||
cutoff.map_or(true, |cutoff| self.when > cutoff)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ impl SkewEstimate {
|
|||
now: Instant,
|
||||
) -> Option<Self> {
|
||||
// Only consider skew observations reported at least this recently.
|
||||
let cutoff = now - Duration::from_secs(3600);
|
||||
let cutoff = now.checked_sub(Duration::from_secs(3600));
|
||||
|
||||
// Don't even look at our observations unless we have at least this
|
||||
// many. (This value is chosen somewhat arbitrarily.)
|
||||
|
|
Loading…
Reference in New Issue