A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::net::HttpConnectionLease Class Reference

A borrowed connection, held for as long as a caller needs it. More...

#include <cpp/a11/net/http/connection_pool.h>

Public Member Functions

 HttpConnectionLease ()=default
 
const std::shared_ptr< Http2Client > & client () const
 
bool reused () const
 
bool multiplexed () const
 
void Release ()
 Releases this share of the connection early; the destructor does it too.
 

Friends

class HttpConnectionPool
 

Detailed Description

A borrowed connection, held for as long as a caller needs it.

The unit of lifetime the pool works in: the connection is closed when the last lease on it goes away. Hold one for the whole exchange – from the request to the last byte of the response, including its trailers – because dropping it early may close the socket mid-response.

Copyable, and a copy is another share of the same connection rather than a new one, so a lease can be captured by whatever outlives the call that took it.

Constructor & Destructor Documentation

◆ HttpConnectionLease()

a11::net::HttpConnectionLease::HttpConnectionLease ( )
default

Member Function Documentation

◆ client()

const std::shared_ptr< Http2Client > & a11::net::HttpConnectionLease::client ( ) const
inline
Returns
The connection, or null for a default-constructed lease.

◆ multiplexed()

bool a11::net::HttpConnectionLease::multiplexed ( ) const
Returns
Whether the connection is HTTP/2.
See also
Http2Client::multiplexed

◆ Release()

void a11::net::HttpConnectionLease::Release ( )
inline

Releases this share of the connection early; the destructor does it too.

◆ reused()

bool a11::net::HttpConnectionLease::reused ( ) const
inline
Returns
Whether this lease joined a connection that already existed.

Friends And Related Symbol Documentation

◆ HttpConnectionPool

friend class HttpConnectionPool
friend

The documentation for this class was generated from the following files: