[control] Fix round 3: revocations never wait for an apply (files and edge at once; under Caddy the reload is left to the end of a running trial), confirmed before the deadline is claimed, the guard marks a trial expired only after a verified load and retries, caddy-revert clears a stale deadline when Pingora serves
This commit is contained in:
@@ -164,6 +164,9 @@ pub struct Control {
|
||||
pub(crate) apply_lock: tokio::sync::Mutex<()>,
|
||||
/// Held while an engine is switched or told to reload its device or certificate files.
|
||||
pub(crate) engine_lock: tokio::sync::Mutex<()>,
|
||||
/// Serialises reading the device records and writing the device files (never held
|
||||
/// across an apply or a switch).
|
||||
pub(crate) devices_lock: tokio::sync::Mutex<()>,
|
||||
/// Why the device files are not (yet) in force, until a retry succeeds.
|
||||
pub devices_problem: Mutex<Option<String>>,
|
||||
}
|
||||
@@ -275,6 +278,7 @@ impl Control {
|
||||
pause_saved: std::sync::atomic::AtomicBool::new(true),
|
||||
apply_lock: tokio::sync::Mutex::new(()),
|
||||
engine_lock: tokio::sync::Mutex::new(()),
|
||||
devices_lock: tokio::sync::Mutex::new(()),
|
||||
devices_problem: Mutex::new(None),
|
||||
cfg,
|
||||
});
|
||||
@@ -1541,7 +1545,10 @@ impl Control {
|
||||
remove_if_exists(&p).map_err(|e| e.to_string())?;
|
||||
}
|
||||
if caddy {
|
||||
// Caddy must run caddy.json again, the last good config; no trial is out any more.
|
||||
// Caddy must run caddy.json again, the last good config (with the device files as
|
||||
// they are now); then no trial is out any more. Under the engine lock, so a device
|
||||
// change that saw the trial and left the reload to this point is not lost.
|
||||
let _engine = self.engine_lock.lock().await;
|
||||
self.caddy_reload().await?;
|
||||
crate::caddy_guard::disarm(&self.cfg.state_dir);
|
||||
return Ok(rev);
|
||||
|
||||
Reference in New Issue
Block a user