Bug: 342500895

Clone this repo:
  1. 79c6c3f Migrate 20 crates to monorepo by James Farrell · 4 months ago main
  2. 0a4f894 Update Android.bp by running cargo_embargo by James Farrell · 4 months ago
  3. aad6cd7 Create patch from LICENSE file am: 4be8fc317b by James Farrell · 6 months ago
  4. 4be8fc3 Create patch from LICENSE file by James Farrell · 6 months ago
  5. 8e0d2bd Merge remote-tracking branch 'origin/upstream' am: 01030d454c am: 96a2e67c68 by Inna Palant · 7 months ago android15-platform-release android15-prebuilt-test android15-release android15-s1-release android15-security-release android15-tests-dev android15-tests-release aml_art_350913340 aml_art_351011240 aml_art_351011340 aml_art_351110180 aml_cbr_350910020 aml_cbr_351011020 aml_doc_350915120 aml_doc_351012120 aml_ext_350912020 aml_hef_350921160 aml_hef_351016140 aml_med_350914000 aml_med_351010060 aml_net_350911020 aml_net_351010000 aml_net_351010020 aml_per_350910080 aml_per_351014000 aml_res_351011000 aml_rkp_350910000 aml_rkp_351011000 aml_sdk_350910000 aml_sta_350911020 aml_tet_350911120 aml_tet_351010220 aml_uwb_350911040 aml_uwb_351011040 aml_wif_350912040 aml_wif_351010040 android-15.0.0_r1 android-15.0.0_r2 android-15.0.0_r3 android-15.0.0_r4 android-15.0.0_r5 android-cts-15.0_r1 android-cts-15.0_r2 android-platform-15.0.0_r1 android-platform-15.0.0_r2 android-platform-15.0.0_r3 android-platform-15.0.0_r4 android-security-15.0.0_r1 android-security-15.0.0_r2 android-security-15.0.0_r3 android-security-15.0.0_r4 android-vts-15.0_r1 android-vts-15.0_r2 frc_350820260 frc_350820420 frc_350820440 frc_350820660 frc_350820860 frc_350820960 frc_350822020

crates.io

hyper-timeout

A connect, read and write timeout aware connector to be used with hyper Client.

Problem

At the time this crate was created, hyper does not support timeouts. There is a way to do general timeouts, but no easy way to get connect, read and write specific timeouts.

Solution

There is a TimeoutConnector that implements the hyper::Connect trait. This connector wraps around HttpConnector or HttpsConnector values and provides timeouts.

Note: In hyper 0.11, a read or write timeout will return a broken pipe error because of the way tokio_proto::ClientProto works

Usage

Hyper version compatibility:

  • The master branch will track on going development for hyper.
  • The 0.4 release supports hyper 0.14.
  • The 0.3 release supports hyper 0.13.
  • The 0.2 release supports hyper 0.12.
  • The 0.1 release supports hyper 0.11.

Assuming you are using hyper 0.14, add this to your Cargo.toml:

[dependencies]
hyper-timeout = "0.4"

See the client example for a working example.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.