fix(host): a bridge that held a host follows the app that takes its place
Plan P15 unit A5, fix round. A bridge started under a `serve` host, when that host went and the app started in its place, took a lease on the app's server: a lease with no host behind it, which never ends. When the app later closed, the assistant got a generic timeout and never "Wanderbooks isn't running". A lease with no host now turns the bridge into the line to whatever runs, as a bridge that began without a host is (`Lease::is_hostless`, `Bridge::keep`), and it answers in the same words when the app is closed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ff2913274
commit
6164d0fa68
2 files changed
+18
No files matched your search
@@ -1005,6 +1005,17 @@ impl Bridge {
|
||||
return;
|
||||
}
|
||||
};
|
||||
// The host this bridge held went, and the app started in its
|
||||
// place: its lease is on a server with no host, which never
|
||||
// ends, so it would never see the app go. The bridge becomes
|
||||
// the line to whatever runs, as a fresh one is, and says the
|
||||
// same words when the app closes (INVARIANT 12).
|
||||
if lease.is_hostless() {
|
||||
drop(lease);
|
||||
self.app.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
self.link.send_replace(Link::Opening);
|
||||
return self.keep_in_app(run_dir).await;
|
||||
}
|
||||
// Until this lease ends: whenever the server is ready and no
|
||||
// session is up, open one. The lease is always heard, even
|
||||
// while a session is being opened or a try waits (INVARIANT 1).
|
||||
|
||||
@@ -166,6 +166,13 @@ struct HostLink {
|
||||
}
|
||||
|
||||
impl Lease {
|
||||
/// Whether this lease is on the app's server with no host behind it
|
||||
/// (INVARIANT 6): it never ends, so a holder that has one follows
|
||||
/// what runs by looking, as a bridge with no host does.
|
||||
pub fn is_hostless(&self) -> bool {
|
||||
self.link.is_none()
|
||||
}
|
||||
|
||||
/// The host's next word: `Ready`, or `Ending` with why; `None` when
|
||||
/// the host is gone without a word.
|
||||
pub async fn next(&mut self) -> Option<HostMsg> {
|
||||
|
||||
Reference in new issue
Block a user