Skip to content

Commit

Permalink
Fixed tokio::select in outgoing interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Razz4780 committed Mar 26, 2024
1 parent 5951db7 commit 6b7c4ba
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions mirrord/intproxy/src/proxies/outgoing/interceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,20 @@ impl BackgroundTask for Interceptor {
},
},

Some(bytes) = message_bus.recv() => {
if bytes.is_empty() {
tracing::trace!("outgoing interceptor -> agent shutdown, shutting down connection with layer");
connected_socket.shutdown().await?;
} else {
connected_socket.send(&bytes).await?;
msg = message_bus.recv() => match msg {
Some(bytes) => {
if bytes.is_empty() {
tracing::trace!("outgoing interceptor -> agent shutdown, shutting down connection with layer");
connected_socket.shutdown().await?;
} else {
connected_socket.send(&bytes).await?;
}
}
},

else => {
tracing::trace!("outgoing interceptor -> no more messages from the agent, exiting");
break Ok(())
None => {
tracing::trace!("outgoing interceptor -> no more messages from the agent, exiting");
break Ok(())
}
},
}
}
Expand Down

0 comments on commit 6b7c4ba

Please sign in to comment.