Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
Thoth::Http::ClientJanitor Struct Reference

The ClientJanitor stores all open Sockets in a pool to optimize consecutive calls. Only use it if you know what you are doing. More...

#include <Client.hpp>

Public Member Functions

void JanitorLoop ()
 

Static Public Member Functions

static ClientJanitorInstance ()
 

Public Attributes

std::mutex poolMutex
 
std::unordered_map< Hermes::IpEndpoint, std::vector< std::shared_ptr< Socket > > > connectionPool
 Group multiple sockets connected to the same endpoint. Before using it lock the poolMutex to not break other threads.
 

Detailed Description

The ClientJanitor stores all open Sockets in a pool to optimize consecutive calls. Only use it if you know what you are doing.

Please use poolMutex while accessing connectionPool to not break other threads. Each 30s it will destruct sockets unused for more than 1 minute.

Member Function Documentation

◆ Instance()

static ClientJanitor & Thoth::Http::ClientJanitor::Instance ( )
static

◆ JanitorLoop()

void Thoth::Http::ClientJanitor::JanitorLoop ( )

Member Data Documentation

◆ connectionPool

std::unordered_map<Hermes::IpEndpoint, std::vector<std::shared_ptr<Socket> > > Thoth::Http::ClientJanitor::connectionPool

Group multiple sockets connected to the same endpoint. Before using it lock the poolMutex to not break other threads.

◆ poolMutex

std::mutex Thoth::Http::ClientJanitor::poolMutex

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