fix: Reset quota on configured address change (#5908)

This commit is contained in:
iequidoo
2024-09-27 12:19:06 -03:00
committed by iequidoo
parent b713e8cd94
commit aacea2de25
2 changed files with 13 additions and 2 deletions

View File

@@ -857,6 +857,8 @@ impl Context {
///
/// This should only be used by test code and during configure.
pub(crate) async fn set_primary_self_addr(&self, primary_new: &str) -> Result<()> {
self.quota.write().await.take();
// add old primary address (if exists) to secondary addresses
let mut secondary_addrs = self.get_all_self_addrs().await?;
// never store a primary address also as a secondary
@@ -869,7 +871,7 @@ impl Context {
self.set_config_internal(Config::ConfiguredAddr, Some(primary_new))
.await?;
self.emit_event(EventType::ConnectivityChanged);
Ok(())
}