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

#include <DownloadQueue.hpp>

Public Member Functions

bool Add (uint64_t id)
void Remove (uint64_t id)
bool Empty () const
std::vector< uint64_t > Required () const
std::vector< uint64_t > FindMissing (int64_t steamId) const
bool HasMissing (int64_t steamId) const
std::vector< uint64_t > ClientMountList (int64_t steamId) const
AddonDecision NextToSend (int64_t steamId, double now, int maxAttempts)
AddonDecision DecideJoinMessage (int64_t steamId, bool reconnect, std::string_view addons, double now, int maxAttempts)
void MarkSending (int64_t steamId, uint64_t id, double now)
void ClientReconnected (int64_t steamId, double now, double timeoutSec)
void ClientLeft (int64_t steamId, double now, double forgetAfterSec)
void ClearProgress ()

Detailed Description

Which required workshop addons each client still owes, and what to send it next. Keyed by SteamID, since a reconnecting client's slot changes; times are monotonic seconds.

Definition at line 32 of file DownloadQueue.hpp.

Member Function Documentation

◆ Add()

bool VoltMod::DownloadQueue::Add ( uint64_t id)

Require id of every client. Reference counted; false for id 0.

Definition at line 11 of file DownloadQueue.cpp.

◆ ClearProgress()

void VoltMod::DownloadQueue::ClearProgress ( )

Forget every client's progress, keeping the requirements.

Definition at line 197 of file DownloadQueue.cpp.

◆ ClientLeft()

void VoltMod::DownloadQueue::ClientLeft ( int64_t steamId,
double now,
double forgetAfterSec )

steamId left; clients gone longer than forgetAfterSec are forgotten.

Definition at line 185 of file DownloadQueue.cpp.

◆ ClientMountList()

std::vector< uint64_t > VoltMod::DownloadQueue::ClientMountList ( int64_t steamId) const

Required addons steamId has downloaded or is downloading: what it mounts on connect.

Definition at line 67 of file DownloadQueue.cpp.

References Required().

Referenced by DecideJoinMessage().

◆ ClientReconnected()

void VoltMod::DownloadQueue::ClientReconnected ( int64_t steamId,
double now,
double timeoutSec )

Count the sending addon as downloaded if steamId reconnected within timeoutSec.

Definition at line 160 of file DownloadQueue.cpp.

◆ DecideJoinMessage()

AddonDecision VoltMod::DownloadQueue::DecideJoinMessage ( int64_t steamId,
bool reconnect,
std::string_view addons,
double now,
int maxAttempts )

Decide one outgoing join message for steamId. A message already sending the client away (reconnect) goes through, and its addon counts as sending.

Definition at line 118 of file DownloadQueue.cpp.

References ClientMountList(), VoltMod::KeepMounted, MarkSending(), NextToSend(), VoltMod::ParseAddonList(), and VoltMod::TrimToFirst.

◆ Empty()

bool VoltMod::DownloadQueue::Empty ( ) const
inline

Whether nothing is required.

Definition at line 40 of file DownloadQueue.hpp.

◆ FindMissing()

std::vector< uint64_t > VoltMod::DownloadQueue::FindMissing ( int64_t steamId) const

What steamId has still to download.

Definition at line 56 of file DownloadQueue.cpp.

References Required().

Referenced by NextToSend().

◆ HasMissing()

bool VoltMod::DownloadQueue::HasMissing ( int64_t steamId) const

Definition at line 81 of file DownloadQueue.cpp.

◆ MarkSending()

void VoltMod::DownloadQueue::MarkSending ( int64_t steamId,
uint64_t id,
double now )

Record that id reached steamId without our offer. Costs no attempt.

Definition at line 147 of file DownloadQueue.cpp.

Referenced by DecideJoinMessage().

◆ NextToSend()

AddonDecision VoltMod::DownloadQueue::NextToSend ( int64_t steamId,
double now,
int maxAttempts )

The next addon for steamId. A repeat offer counts an attempt; past maxAttempts, Kick.

Definition at line 95 of file DownloadQueue.cpp.

References FindMissing(), VoltMod::Kick, and VoltMod::Send.

Referenced by DecideJoinMessage().

◆ Remove()

void VoltMod::DownloadQueue::Remove ( uint64_t id)

Definition at line 30 of file DownloadQueue.cpp.

◆ Required()

std::vector< uint64_t > VoltMod::DownloadQueue::Required ( ) const

What every client must have, in send order.

Definition at line 39 of file DownloadQueue.cpp.

Referenced by ClientMountList(), and FindMissing().


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