Skip to content

Commit

Permalink
Retry connecting to broker in bridge test proxy
Browse files Browse the repository at this point in the history
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
  • Loading branch information
jarhodes314 committed Aug 21, 2024
1 parent 162f9a8 commit 6a57685
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/extensions/tedge_mqtt_bridge/tests/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ impl Proxy {
let mut stop = stop_rx.clone();
stop.mark_unchanged();
if let Ok((mut socket, _)) = listener.accept().await {
let mut conn = tokio::net::TcpStream::connect(&target).await.unwrap();
let mut conn = loop {
let Ok(conn) = tokio::net::TcpStream::connect(&target).await else {
continue;
};
break conn;
};
tokio::spawn(async move {
let (mut read_socket, mut write_socket) = socket.split();
let (mut read_conn, mut write_conn) = conn.split();
Expand Down

0 comments on commit 6a57685

Please sign in to comment.