|
VoltMod
C++23 framework for CS2 server plugins
|
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 () |
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.
|
explicit |
scheduler must outlive the client.
Definition at line 109 of file HttpClient.cpp.
| VoltMod::HttpClient::~HttpClient | ( | ) |
Definition at line 113 of file HttpClient.cpp.
References Stop().
|
delete |
|
delete |
| 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().
| 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().