Skip to content

Commit e9be344

Browse files
authored
docs(client): document Drop behavior for Connection types (#4064)
Explain what happens when Connection is dropped: the underlying IO resource is closed and in-flight requests are interrupted. Suggest polling to completion for graceful shutdown. Closes #3192 Co-authored-by: lihan3238 <lihan3238@users.noreply.github.com>
1 parent cdecfee commit e9be344

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/client/conn/http1.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ pub struct Parts<T> {
5050
/// can process incoming and outgoing messages, notice hangups, and the like.
5151
///
5252
/// Instances of this type are typically created via the [`handshake`] function
53+
///
54+
/// # Drop behavior
55+
///
56+
/// Dropping the `Connection` will close the underlying IO resource.
57+
/// Any in-flight requests that have not received a response will be
58+
/// interrupted. If graceful shutdown is desired, poll the connection
59+
/// until it completes instead of dropping.
5360
#[must_use = "futures do nothing unless polled"]
5461
pub struct Connection<T, B>
5562
where

src/client/conn/http2.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ impl<B> Clone for SendRequest<B> {
3939
/// can process incoming and outgoing messages, notice hangups, and the like.
4040
///
4141
/// Instances of this type are typically created via the [`handshake`] function
42+
///
43+
/// # Drop behavior
44+
///
45+
/// Dropping the `Connection` will close the underlying IO resource.
46+
/// Any in-flight requests that have not received a response will be
47+
/// interrupted. If graceful shutdown is desired, poll the connection
48+
/// until it completes instead of dropping.
4249
#[must_use = "futures do nothing unless polled"]
4350
pub struct Connection<T, B, E>
4451
where

0 commit comments

Comments
 (0)