VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::HttpClient Class Reference

Runs HTTP requests off the game thread and their completions on it. More...

#include <HttpClient.hpp>

Classes

struct  Requests
 

Public Member Functions

 HttpClient (Scheduler &scheduler)
 
 ~HttpClient ()
 
 HttpClient (const HttpClient &)=delete
 
HttpClient & operator= (const HttpClient &)=delete
 
void Send (HttpRequest request, HttpCompletion onComplete)
 
void Stop ()
 

Detailed Description

Runs HTTP requests off the game thread and their completions on it.

Up to four run at once on kept worker threads and 64 more may wait; later ones fail.

Definition at line 66 of file HttpClient.hpp.

Constructor & Destructor Documentation

◆ HttpClient() [1/2]

VoltMod::HttpClient::HttpClient ( Scheduler &  scheduler)
explicit

scheduler must outlive the client.

Definition at line 109 of file HttpClient.cpp.

◆ ~HttpClient()

VoltMod::HttpClient::~HttpClient ( )

Definition at line 113 of file HttpClient.cpp.

References Stop().

◆ HttpClient() [2/2]

VoltMod::HttpClient::HttpClient ( const HttpClient &  )
delete

Member Function Documentation

◆ operator=()

HttpClient & VoltMod::HttpClient::operator= ( const HttpClient &  )
delete

◆ Send()

void VoltMod::HttpClient::Send ( HttpRequest  request,
HttpCompletion  onComplete 
)

Run request; onComplete runs on the game thread on a later frame. Dropped after Stop.

Definition at line 118 of file HttpClient.cpp.

References VoltMod::MaxWaiting, VoltMod::MaxWorkers, VoltMod::ReadFile(), and VoltMod::Log::Warn().

◆ Stop()

void VoltMod::HttpClient::Stop ( )

Abort the running requests, drop the waiting ones and join the workers; no completion runs after this, and later sends are dropped.

Definition at line 146 of file HttpClient.cpp.

References VoltMod::ReadFile().

Referenced by ~HttpClient(), and VoltMod::Runtime::~Runtime().


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