chore(connlib): remove unused event (#4110)

Seems to be a left-over from a previous design.
This commit is contained in:
Thomas Eizinger
2024-03-13 14:25:21 +11:00
committed by GitHub
parent 1cfe2c5d4a
commit 5744ed2a13
3 changed files with 16 additions and 30 deletions

View File

@@ -123,9 +123,7 @@ where
.send(PHOENIX_TOPIC, EgressMessages::ReuseConnection(connection));
}
}
firezone_tunnel::Event::SendPacket { .. }
| firezone_tunnel::Event::StopPeer { .. }
| firezone_tunnel::Event::DeviceConfigUpdated => {
firezone_tunnel::Event::SendPacket { .. } | firezone_tunnel::Event::StopPeer { .. } => {
unreachable!("Handled internally")
}
}

View File

@@ -167,10 +167,21 @@ where
Ok(())
}
pub(crate) fn update_interface(&mut self) -> connlib_shared::Result<()> {
let dns_mapping = self.role_state.dns_mapping();
let config =
self.role_state.interface_config.as_ref().expect("Developer error: we should always call update_interface after the interface config is set");
/// Sets the interface configuration and starts background tasks.
#[tracing::instrument(level = "trace", skip(self))]
pub fn set_interface(&mut self, config: &InterfaceConfig) -> connlib_shared::Result<()> {
self.role_state.interface_config = Some(config.clone());
let effective_dns_servers = effective_dns_servers(
config.upstream_dns.clone(),
self.callbacks()
.get_system_default_resolvers()
.ok()
.flatten()
.unwrap_or_default(),
);
let dns_mapping = sentinel_dns_mapping(&effective_dns_servers);
self.role_state.set_dns_mapping(dns_mapping.clone());
self.device.initialize(
config,
@@ -190,24 +201,6 @@ where
Ok(())
}
/// Sets the interface configuration and starts background tasks.
#[tracing::instrument(level = "trace", skip(self))]
pub fn set_interface(&mut self, config: &InterfaceConfig) -> connlib_shared::Result<()> {
self.role_state.interface_config = Some(config.clone());
let effective_dns_servers = effective_dns_servers(
config.upstream_dns.clone(),
self.callbacks()
.get_system_default_resolvers()
.ok()
.flatten()
.unwrap_or_default(),
);
let dns_mapping = sentinel_dns_mapping(&effective_dns_servers);
self.role_state.set_dns_mapping(dns_mapping);
self.update_interface()
}
/// Clean up a connection to a resource.
// FIXME: this cleanup connection is wrong!
pub fn cleanup_connection(&mut self, id: ResourceId) {

View File

@@ -77,10 +77,6 @@ where
self.device.write(packet)?;
cx.waker().wake_by_ref();
}
Poll::Ready(Event::DeviceConfigUpdated) => {
self.update_interface()?;
cx.waker().wake_by_ref()
}
Poll::Ready(other) => return Poll::Ready(Ok(other)),
_ => (),
}
@@ -423,5 +419,4 @@ pub enum Event<TId> {
},
SendPacket(IpPacket<'static>),
StopPeer(TId),
DeviceConfigUpdated,
}