add http changelog

This commit is contained in:
Rob Ede 2021-11-05 01:31:49 +00:00
parent 59b8c25bdc
commit b1b6201c20
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 15 additions and 10 deletions

View File

@ -1,11 +1,15 @@
# Changes # Changes
## Unreleased - 2021-xx-xx ## Unreleased - 2021-xx-xx
### Changed
* Add keep alive to h2 through ping-pong. [#2433]
### Removed ### Removed
* `client` module. [#2425] * `client` module. [#2425]
* `trust-dns` feature. [#2425] * `trust-dns` feature. [#2425]
[#2425]: https://github.com/actix/actix-web/pull/2425 [#2425]: https://github.com/actix/actix-web/pull/2425
[#2433]: https://github.com/actix/actix-web/pull/2433
## 3.0.0-beta.11 - 2021-10-20 ## 3.0.0-beta.11 - 2021-10-20

View File

@ -58,7 +58,7 @@ where
) -> Self { ) -> Self {
let ping_pong = config.keep_alive_timer().map(|timer| H2PingPong { let ping_pong = config.keep_alive_timer().map(|timer| H2PingPong {
timer: Box::pin(timer), timer: Box::pin(timer),
on_flight: false, in_flight: false,
ping_pong: connection.ping_pong().unwrap(), ping_pong: connection.ping_pong().unwrap(),
}); });
@ -76,7 +76,7 @@ where
struct H2PingPong { struct H2PingPong {
timer: Pin<Box<Sleep>>, timer: Pin<Box<Sleep>>,
on_flight: bool, in_flight: bool,
ping_pong: PingPong, ping_pong: PingPong,
} }
@ -147,13 +147,13 @@ where
Poll::Ready(None) => return Poll::Ready(Ok(())), Poll::Ready(None) => return Poll::Ready(Ok(())),
Poll::Pending => match this.ping_pong.as_mut() { Poll::Pending => match this.ping_pong.as_mut() {
Some(ping_pong) => loop { Some(ping_pong) => loop {
if ping_pong.on_flight { if ping_pong.in_flight {
// When have on flight ping pong. poll pong and and keep alive timer. // When ping-pong is in-flight, poll pong and and keep alive timer
// on success pong received update keep alive timer to determine the next timing of // on success pong received and update keep alive timer to determine the
// ping pong. // next timing of ping-pong.
match ping_pong.ping_pong.poll_pong(cx)? { match ping_pong.ping_pong.poll_pong(cx)? {
Poll::Ready(_) => { Poll::Ready(_) => {
ping_pong.on_flight = false; ping_pong.in_flight = false;
let dead_line = let dead_line =
this.config.keep_alive_expire().unwrap(); this.config.keep_alive_expire().unwrap();
@ -168,8 +168,9 @@ where
} }
} }
} else { } else {
// When there is no on flight ping pong. keep alive timer is used to wait for next // When there is no in-flight ping-pong, keep alive timer is used to
// timing of ping pong. Therefore at this point it serves as an interval instead. // wait for next timing of ping-pong. Therefore, at this point it serves
// as an interval instead.
ready!(ping_pong.timer.as_mut().poll(cx)); ready!(ping_pong.timer.as_mut().poll(cx));
ping_pong.ping_pong.send_ping(Ping::opaque())?; ping_pong.ping_pong.send_ping(Ping::opaque())?;
@ -177,7 +178,7 @@ where
let dead_line = this.config.keep_alive_expire().unwrap(); let dead_line = this.config.keep_alive_expire().unwrap();
ping_pong.timer.as_mut().reset(dead_line); ping_pong.timer.as_mut().reset(dead_line);
ping_pong.on_flight = true; ping_pong.in_flight = true;
} }
}, },
None => return Poll::Pending, None => return Poll::Pending,