From 1015251bd9fd8250ddc2df7a1aed812e183241b4 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 16 Dec 2024 13:33:04 +0100 Subject: [PATCH] comments --- sdk/rust/nym-sdk/examples/tcp_proxy_multistream.rs | 3 ++- sdk/rust/nym-sdk/examples/tcp_proxy_single_connection.rs | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sdk/rust/nym-sdk/examples/tcp_proxy_multistream.rs b/sdk/rust/nym-sdk/examples/tcp_proxy_multistream.rs index ff540302de..6d61ea2ca1 100644 --- a/sdk/rust/nym-sdk/examples/tcp_proxy_multistream.rs +++ b/sdk/rust/nym-sdk/examples/tcp_proxy_multistream.rs @@ -124,8 +124,9 @@ async fn main() -> anyhow::Result<()> { } // Once timeout is passed, you can either wait for graceful shutdown or just hard stop it. + // TODO CHANGE make this a task listening for ctrl_c, add cancel token to loops + call client.disconnect() on ctrl_c signal::ctrl_c().await?; - println!("CTRL+C received, shutting down"); + println!("CTRL_C received, shutting down"); Ok(()) } diff --git a/sdk/rust/nym-sdk/examples/tcp_proxy_single_connection.rs b/sdk/rust/nym-sdk/examples/tcp_proxy_single_connection.rs index df41d503e7..c8388da8bf 100644 --- a/sdk/rust/nym-sdk/examples/tcp_proxy_single_connection.rs +++ b/sdk/rust/nym-sdk/examples/tcp_proxy_single_connection.rs @@ -61,9 +61,9 @@ async fn main() -> anyhow::Result<()> { // We'll run the instance with a long timeout since we're sending everything down the same Tcp connection, so should be using a single session. // Within the TcpProxyClient, individual client shutdown is triggered by the timeout. - // The final argument is how many clients to keep in reserve in the client pool when running the TcpProxy: since we're only expecting 1 connection in total, we can start with no clients in the pool, and the TcpProxyClient will just spin up an ephemeral client outside of the pool to use. + // The final argument is how many clients to keep in reserve in the client pool when running the TcpProxy. let proxy_client = - tcp_proxy::NymProxyClient::new(*proxy_nym_addr, "127.0.0.1", &client_port, 5, Some(env), 0) + tcp_proxy::NymProxyClient::new(*proxy_nym_addr, "127.0.0.1", &client_port, 5, Some(env), 1) .await?; tokio::spawn(async move { @@ -179,8 +179,9 @@ async fn main() -> anyhow::Result<()> { } // Once timeout is passed, you can either wait for graceful shutdown or just hard stop it. + // TODO CHANGE make this a task listening for ctrl_c, add cancel token to loops + call client.disconnect() on ctrl_c signal::ctrl_c().await?; - println!(":: CTRL+C received, shutting down + cleanup up proxy server config files"); + println!(":: CTRL_C received, shutting down + cleanup up proxy server config files"); fs::remove_dir_all(conf_path)?; Ok(()) }