|
VoltMod
C++23 framework for CS2 server plugins
|
Per-client network-channel access: latency and the client's replicated userinfo cvars. More...
#include <NetChannel.hpp>
Public Member Functions | |
| NetChannels (Interfaces &interfaces) | |
| INetChannelInfo * | GetNetInfo (int slot) const |
| float | EngineLatency (int slot) const |
| std::string_view | GetUserInfoCvar (int slot, std::string_view name) const |
Per-client network-channel access: latency and the client's replicated userinfo cvars.
Stateless wrapper over IVEngineServer2: every call reads the engine live, so nothing here needs a lifecycle. Bots, empty slots and clients already torn down have no channel, and each accessor degrades to a null/zero result rather than asserting.
Definition at line 17 of file NetChannel.hpp.
|
inlineexplicit |
interfaces supplies IVEngineServer2; it must outlive this service.
Definition at line 21 of file NetChannel.hpp.
Round-trip time in seconds, or 0 when the channel is unavailable.
Definition at line 16 of file NetChannel.cpp.
References GetNetInfo(), and VoltMod::ReadFile().
| INetChannelInfo * VoltMod::NetChannels::GetNetInfo | ( | int | slot | ) | const |
The client's channel, or nullptr when slot has none (bot, empty, disconnecting).
Definition at line 10 of file NetChannel.cpp.
References VoltMod::Interfaces::Engine, VoltMod::IsValidSlot(), and VoltMod::ReadFile().
Referenced by EngineLatency().
| std::string_view VoltMod::NetChannels::GetUserInfoCvar | ( | int | slot, |
| std::string_view | name | ||
| ) | const |
The client's value for the userinfo convar name, or empty when the slot has no client, the engine is unavailable, or the client never sent one.
The view borrows the engine's own buffer, which the next userinfo update replaces: read it or copy it before returning to the engine, and never store it.
Definition at line 22 of file NetChannel.cpp.
References VoltMod::Interfaces::Engine, VoltMod::IsValidSlot(), and VoltMod::ReadFile().