Skip to content

Commit

Permalink
refactor(app/integration): inline Running future (linkerd#3686)
Browse files Browse the repository at this point in the history
`linkerd_app_integration::running()` is a public function that is not
used by any external callers. this function is used in one place, when
setting up test client used for integration tests.

this commit inlines this logic, and moves the associated `Running` type
alias down alongside the `Run` enum.

Signed-off-by: katelyn martin <[email protected]>
  • Loading branch information
cratelyn authored Mar 3, 2025
1 parent 93aecec commit be86830
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 8 additions & 1 deletion linkerd/app/integration/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ enum Run {
Http2,
}

pub type Running = Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>;

fn run(
addr: SocketAddr,
version: Run,
Expand All @@ -235,7 +237,12 @@ fn run(
false
};

let (running_tx, running) = running();
let (running_tx, running) = {
let (tx, rx) = oneshot::channel();
let rx = Box::pin(rx.map(|_| ()));
(tx, rx)
};

let conn = Conn {
addr,
absolute_uris,
Expand Down
9 changes: 0 additions & 9 deletions linkerd/app/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,6 @@ impl Shutdown {

pub type ShutdownRx = Pin<Box<dyn Future<Output = ()> + Send>>;

/// A channel used to signal when a Client's related connection is running or closed.
pub fn running() -> (oneshot::Sender<()>, Running) {
let (tx, rx) = oneshot::channel();
let rx = Box::pin(rx.map(|_| ()));
(tx, rx)
}

pub type Running = Pin<Box<dyn Future<Output = ()> + Send + Sync + 'static>>;

pub fn s(bytes: &[u8]) -> &str {
::std::str::from_utf8(bytes).unwrap()
}
Expand Down

0 comments on commit be86830

Please sign in to comment.