hyper-util icon indicating copy to clipboard operation
hyper-util copied to clipboard

feat(client): expose connection reuse state to `Connected`

Open zino299792 opened this issue 10 months ago • 2 comments

  • Add a field is_reused to Connected and a method exposing is_reused.
  • Add a new function mark_as_reused in the Poolable interface that allows to mark a connection as reused.
  • Mark a connection as reused in Pool<T, K>::reuse via Pollable::mark_as_reused.
  • Tests
    • src/client/legacy/pool.rs: test dumb connection CanMarkReused
    • src/tests/legacy_client.rs: test capturing connection reuse info with hyper_util::client::legacy::connect::capture_connection.

Fix #3835.

zino299792 avatar Jan 20 '25 09:01 zino299792

Test results:

$ cargo test reuse --features full
running 1 test
test client::legacy::pool::tests::mark_conn_as_reused ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 38 filtered out; finished in 0.00s

     Running tests/legacy_client.rs (target/debug/deps/legacy_client-77b3265b9280e812)

running 1 test
test get_conn_reuse_info_via_connected ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 17 filtered out; finished in 0.05s

zino299792 avatar Jan 20 '25 09:01 zino299792

Hi @seanmonstar, if you have time, could you take a look on this PR?

zino299792 avatar Jan 22 '25 14:01 zino299792