Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
SC::HttpConnectionsPool Struct Reference

A pool of HttpConnection that can be active or inactive. More...

#include <HttpConnection.h>

Public Member Functions

Result init (Span< HttpConnection > connectionsStorage, Span< char > headersMemoryStorage)
 Initializes the server with memory buffers for connections and headers.
 
Result close ()
 Closes the server, removing references to the memory buffers passed during init.
 
size_t getNumActiveConnections () const
 Returns only the number of active connections.
 
size_t getNumTotalConnections () const
 Returns the total number of connections (active + inactive)
 
HttpConnectiongetConnection (HttpConnection::ID connectionID)
 Returns a connection by ID.
 
HttpConnectiongetConnectionAt (size_t idx)
 Returns a connection in the [0, getNumTotalConnections] range.
 
bool activateNew (HttpConnection::ID &connectionID)
 Finds an available connection (if any), activates it and returns its ID to use with getConnection(id)
 
bool deactivate (HttpConnection::ID connectionID)
 De-activates a connection previously returned by activateNew.
 

Detailed Description

A pool of HttpConnection that can be active or inactive.

Member Function Documentation

◆ activateNew()

bool SC::HttpConnectionsPool::activateNew ( HttpConnection::ID & connectionID)
nodiscard

Finds an available connection (if any), activates it and returns its ID to use with getConnection(id)

◆ close()

Result SC::HttpConnectionsPool::close ( )

Closes the server, removing references to the memory buffers passed during init.

◆ deactivate()

bool SC::HttpConnectionsPool::deactivate ( HttpConnection::ID connectionID)
nodiscard

De-activates a connection previously returned by activateNew.

◆ getConnection()

HttpConnection & SC::HttpConnectionsPool::getConnection ( HttpConnection::ID connectionID)
inlinenodiscard

Returns a connection by ID.

◆ getConnectionAt()

HttpConnection & SC::HttpConnectionsPool::getConnectionAt ( size_t idx)
inlinenodiscard

Returns a connection in the [0, getNumTotalConnections] range.

◆ getNumActiveConnections()

size_t SC::HttpConnectionsPool::getNumActiveConnections ( ) const
inlinenodiscard

Returns only the number of active connections.

◆ getNumTotalConnections()

size_t SC::HttpConnectionsPool::getNumTotalConnections ( ) const
inlinenodiscard

Returns the total number of connections (active + inactive)

◆ init()

Result SC::HttpConnectionsPool::init ( Span< HttpConnection > connectionsStorage,
Span< char > headersMemoryStorage )

Initializes the server with memory buffers for connections and headers.


The documentation for this struct was generated from the following file: