Skip to content

Commit

Permalink
fix: remove is_relay check
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Mar 3, 2025
1 parent f3e866b commit e1c3e2a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
3 changes: 1 addition & 2 deletions crates/xds/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ impl MdsClient {
);

let change_watcher = tokio::spawn({
let mut this = control_plane.clone();
this.is_relay = true; // This is a lie, but means we don't unneccessarily watch for filter changes on the agent, which doesn't perform them
let this = control_plane.clone();
control_plane.config.on_changed(this)
});

Expand Down
11 changes: 2 additions & 9 deletions crates/xds/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub struct ControlPlane<C> {
pub config: Arc<C>,
pub idle_request_interval: Duration,
tx: tokio::sync::broadcast::Sender<&'static str>,
pub is_relay: bool,
}

impl<C> Clone for ControlPlane<C> {
Expand All @@ -113,7 +112,6 @@ impl<C> Clone for ControlPlane<C> {
config: self.config.clone(),
idle_request_interval: self.idle_request_interval,
tx: self.tx.clone(),
is_relay: self.is_relay,
}
}
}
Expand All @@ -126,7 +124,6 @@ impl<C: crate::config::Configuration> ControlPlane<C> {
config,
idle_request_interval,
tx,
is_relay: false,
}
}

Expand All @@ -137,11 +134,10 @@ impl<C: crate::config::Configuration> ControlPlane<C> {
}

pub fn management_server(
mut self,
self,
listener: TcpListener,
tls: Option<TlsIdentity>,
) -> eyre::Result<impl std::future::Future<Output = crate::Result<()>>> {
self.is_relay = false;
tokio::spawn({
let this = self.clone();
self.config.on_changed(this)
Expand All @@ -165,11 +161,10 @@ impl<C: crate::config::Configuration> ControlPlane<C> {
}

pub fn relay_server(
mut self,
self,
listener: TcpListener,
tls: Option<TlsIdentity>,
) -> eyre::Result<impl std::future::Future<Output = crate::Result<()>>> {
self.is_relay = true;
tokio::spawn({
let this = self.clone();
self.config.on_changed(this)
Expand Down Expand Up @@ -197,7 +192,6 @@ impl<C: crate::config::Configuration> ControlPlane<C> {
tracing::debug!(
%resource_type,
id = self.config.identifier(),
is_relay = self.is_relay,
"pushing update"
);
if self.tx.send(resource_type).is_err() {
Expand Down Expand Up @@ -239,7 +233,6 @@ impl<C: crate::config::Configuration> ControlPlane<C> {
id,
client = node_id,
count = this.tx.receiver_count(),
is_relay = this.is_relay,
"subscribed to config updates"
);

Expand Down
8 changes: 1 addition & 7 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,7 @@ impl quilkin_xds::config::Configuration for Config {
&self,
control_plane: quilkin_xds::server::ControlPlane<Self>,
) -> impl std::future::Future<Output = ()> + Send + 'static {
if let Some(fc) = control_plane
.config
.dyn_cfg
.typemap
.get::<FilterChain>()
.filter(|_| !control_plane.is_relay)
{
if let Some(fc) = control_plane.config.dyn_cfg.typemap.get::<FilterChain>() {
fc.watch({
let this = control_plane.clone();
move |_| {
Expand Down

0 comments on commit e1c3e2a

Please sign in to comment.