chore: comment cleanup pass ahead of open-sourcing
Some checks failed
Build Linux Binaries / linux/amd64 (push) Has been cancelled
Build Linux Binaries / linux/arm64 (push) Has been cancelled

Removes leftover debug scaffolding (stray Console.WriteLine/NSLog traces,
dead nick_buf_ptr, a no-op --print-config flag now implemented for real),
fixes stale/misleading comments (channel passwords are no longer a "future
M5+" feature, a wrong cross-reference, a stale TlsContext::close() mention,
an incomplete BanRecord::subject_type doc, and a smoke test pointing at a
build/m1-dev preset that no longer exists), strips internal M1-M5 milestone
jargon from comments now that the roadmap is done, trims comments that just
restated the following line, and consolidates a few "why" explanations that
were duplicated 2-3 times in the same file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 10:20:18 +01:00
parent bda37ec27b
commit bba605401d
50 changed files with 229 additions and 331 deletions

View File

@@ -2,7 +2,7 @@
* server/session_registry.h — In-memory session, channel, and user registry.
*
* Tracks all authenticated sessions, the channel tree, user<→>channel assignments,
* UDP endpoint bindings (M2), and SSRC<→>session mappings (M2).
* UDP endpoint bindings, and SSRC<→>session mappings.
* Protected by a shared_mutex (many readers, few writers). All methods are thread-safe.
*/
#ifndef VOICECAT_SERVER_SESSION_REGISTRY_H
@@ -144,7 +144,7 @@ class SessionRegistry {
// Check a channel password.
bool check_channel_password(uint32_t channel_id, const std::string& password) const;
// ── M2: UDP / media ────────────────────────────────────────────────────────
// ── UDP / media ────────────────────────────────────────────────────────────
// Register a session's UDP token (called at auth success).
void register_udp_token(const std::array<uint8_t, 16>& token, uint64_t session_id);
@@ -177,7 +177,7 @@ class SessionRegistry {
// Return the channel_id of a user (0 if not found).
uint32_t user_channel(uint32_t user_id) const;
// Return a channel's authoritative AudioConfig (M3 per-channel Opus tuning), or nullopt
// Return a channel's authoritative AudioConfig (per-channel Opus tuning), or nullopt
// if the channel doesn't exist. There is no per-id Channel getter today otherwise —
// channel_snapshot() copies every channel, which callers needing just one config should
// avoid.
@@ -199,7 +199,7 @@ class SessionRegistry {
std::unordered_map<uint32_t, ChannelEntry> channels_;
std::unordered_map<uint64_t, voicecat::v1::Permissions> session_permissions_;
// M2: token → session_id (populated at auth, cleared on disconnect)
// Token → session_id (populated at auth, cleared on disconnect)
struct TokenHash {
size_t operator()(const std::array<uint8_t, 16>& t) const {
// FNV-1a over 16 bytes
@@ -210,10 +210,10 @@ class SessionRegistry {
};
std::unordered_map<std::array<uint8_t, 16>, uint64_t, TokenHash> udp_tokens_;
// M2: UDP endpoint → session_id (populated after UDP binding packet arrives)
// UDP endpoint → session_id (populated after UDP binding packet arrives)
std::unordered_map<asio::ip::udp::endpoint, uint64_t, UdpEndpointHash> udp_endpoints_;
// M2: ssrc → session_id (populated when StreamAnnounce is processed)
// ssrc → session_id (populated when StreamAnnounce is processed)
std::unordered_map<uint32_t, uint64_t> ssrc_to_session_;
std::atomic<uint32_t> next_ssrc_{1};
};