fix(core): preserve plugin URLs across binding updates

BindInfo::update was replacing addresses with a new DerivedAddressInfo
that cleared the available set, wiping plugin-exported URLs whenever
bind() was called. Also simplify update_addresses plugin preservation
to use retain in place rather than collecting into a separate set.
This commit is contained in:
Aiden McClelland
2026-02-23 17:56:15 -07:00
parent bee8a0f9d8
commit b7da7cd59f
2 changed files with 4 additions and 14 deletions

View File

@@ -92,15 +92,10 @@ impl Model<Host> {
for (_, bind) in this.bindings.as_entries_mut()? {
let net = bind.as_net().de()?;
let opt = bind.as_options().de()?;
// Preserve existing plugin-provided addresses across recomputation
let plugin_addrs: BTreeSet<HostnameInfo> = bind
.as_addresses()
.as_available()
.de()?
.into_iter()
.filter(|h| matches!(h.metadata, HostnameMetadata::Plugin { .. }))
.collect();
let mut available = BTreeSet::new();
let mut available = bind.as_addresses().as_available().de()?;
available.retain(|h| matches!(h.metadata, HostnameMetadata::Plugin { .. }));
for (gid, g) in gateways {
let Some(ip_info) = &g.ip_info else {
continue;
@@ -290,7 +285,6 @@ impl Model<Host> {
});
}
}
available.extend(plugin_addrs);
bind.as_addresses_mut().as_available_mut().ser(&available)?;
}