Duplex transport is incompatible with `serve_with_incoming_shutdown`
- Dominant language
- Rust
- Stars
- 12.5k
- Forks
- 1.3k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 24
Description
## Bug Report
### Version
11.0 / HEAD
### Platform
Darwin (macOS Sonoma 14.2.1) kernel version 23.2.0
### Description
In trying to integration test a tonic client/server, I found the "examples/src/mock" example using tokio::io::duplex as the transport channel. This worked fine, until I changed `serve_with_incoming` to `serve_with_incoming_shutdown`.
Replacing
```
tokio::spawn(async move {
Server::builder()
.add_service(GreeterServer::new(greeter))
.serve_with_incoming(tokio_stream::once(Ok::<_, std::io::Error>(server)))
.await
});
```
with
```
tokio::spawn(async move {
Server::builder()
.add_service(GreeterServer::new(greeter))
.serve_with_incoming_shutdown(
tokio_stream::once(Ok::<_, std::io::Error>(server)),
async move { std::future::pending().await },
)
.await
});
```
in `examples/src/mock/mock.rs` demonstrates that the example no longer runs successfully, instead erroring with a "Client already taken" error. This was unexpected to me.
Contributor guide
Assessment
This issue has not been assessed yet.