mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
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:
@@ -204,11 +204,7 @@ impl BindInfo {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
options,
|
options,
|
||||||
net: lan,
|
net: lan,
|
||||||
addresses: DerivedAddressInfo {
|
addresses,
|
||||||
enabled: addresses.enabled,
|
|
||||||
disabled: addresses.disabled,
|
|
||||||
available: BTreeSet::new(),
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
pub fn disable(&mut self) {
|
pub fn disable(&mut self) {
|
||||||
|
|||||||
@@ -92,15 +92,10 @@ impl Model<Host> {
|
|||||||
for (_, bind) in this.bindings.as_entries_mut()? {
|
for (_, bind) in this.bindings.as_entries_mut()? {
|
||||||
let net = bind.as_net().de()?;
|
let net = bind.as_net().de()?;
|
||||||
let opt = bind.as_options().de()?;
|
let opt = bind.as_options().de()?;
|
||||||
|
|
||||||
// Preserve existing plugin-provided addresses across recomputation
|
// Preserve existing plugin-provided addresses across recomputation
|
||||||
let plugin_addrs: BTreeSet<HostnameInfo> = bind
|
let mut available = bind.as_addresses().as_available().de()?;
|
||||||
.as_addresses()
|
available.retain(|h| matches!(h.metadata, HostnameMetadata::Plugin { .. }));
|
||||||
.as_available()
|
|
||||||
.de()?
|
|
||||||
.into_iter()
|
|
||||||
.filter(|h| matches!(h.metadata, HostnameMetadata::Plugin { .. }))
|
|
||||||
.collect();
|
|
||||||
let mut available = BTreeSet::new();
|
|
||||||
for (gid, g) in gateways {
|
for (gid, g) in gateways {
|
||||||
let Some(ip_info) = &g.ip_info else {
|
let Some(ip_info) = &g.ip_info else {
|
||||||
continue;
|
continue;
|
||||||
@@ -290,7 +285,6 @@ impl Model<Host> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
available.extend(plugin_addrs);
|
|
||||||
bind.as_addresses_mut().as_available_mut().ser(&available)?;
|
bind.as_addresses_mut().as_available_mut().ser(&available)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user