Skip to content

Commit 281df9c

Browse files
committed
fix(xds): add mutiple async connections to the server
Signed-off-by: hanshal101 <[email protected]>
1 parent fc24c42 commit 281df9c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

orion-xds/examples/server_secret_rotation_simple.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3131
});
3232
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
3333

34-
let var_name = async move {
34+
let delta_resource_tx_clone = delta_resource_tx.clone();
35+
36+
let _xds_resource_producer = tokio::spawn(async move {
3537
// the secret name needs to match ../orion-proxy/conf/orion-bootstap-sds-simple.yaml
3638
// we are trying to change secret beefcake_ca to point to a different cert store
3739
// initially the proxy should return 502 error as it can't set up tls to upstream
@@ -54,9 +56,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5456
let secret_type = secret::Type::ValidationContext(validation_context);
5557
let secret = resources::create_secret(secret_id, secret_type);
5658
info!("Adding upstream secret {secret_id}");
57-
let _secret_resource = resources::create_secret_resource(secret_id, &secret);
58-
};
59-
let _xds_resource_producer = tokio::spawn(var_name);
59+
let secret_resource = resources::create_secret_resource(secret_id, &secret);
60+
61+
if delta_resource_tx_clone.send(ServerAction::Add(secret_resource)).is_err() {
62+
info!("Failed to send secret resource");
63+
}
64+
});
6065

6166
let _ = grpc_server.into_future().await;
6267
Ok(())

0 commit comments

Comments
 (0)