Cleanup net/ comments
Some checks failed
Build Linux Binaries / linux/amd64 (push) Has been cancelled
Build Linux Binaries / linux/arm64 (push) Has been cancelled

This commit is contained in:
2026-07-03 15:49:32 +01:00
parent 158a2df062
commit eafa5eb90c
3 changed files with 15 additions and 20 deletions

View File

@@ -1,8 +1,6 @@
/*
* net/transport.h TCP control channel + UDP media channel.
* net/transport.h: TCP control channel + UDP media channel.
*
* Design: docs/architecture.md (Net thread), docs/protocol.md §1 (framing).
* Implementation uses standalone Asio for sockets and timers.
*/
#ifndef VOICECAT_NET_TRANSPORT_H
#define VOICECAT_NET_TRANSPORT_H
@@ -40,7 +38,7 @@ struct TcpChannelCallbacks {
std::function<void(voicecat::crypto::TlsContext&)> on_tls_ready;
};
// ── Client-side: owns an io_context + dedicated net thread ──────────────────
// Client-side: owns an io_context + dedicated net thread
class TcpControlChannel {
public:
explicit TcpControlChannel(TcpChannelCallbacks cbs);
@@ -84,7 +82,7 @@ class TcpControlChannel {
std::atomic<bool> closing_{false};
};
// ── Server-side: one per accepted socket, shares the server's io_context ────
// Server-side: one per accepted socket, shares the server's io_context
class TcpServerConn : public std::enable_shared_from_this<TcpServerConn> {
public:
// Plain TCP constructor (no TLS — for tests or future plaintext paths).
@@ -113,13 +111,13 @@ class TcpServerConn : public std::enable_shared_from_this<TcpServerConn> {
bool connected() const { return connected_.load(std::memory_order_acquire); }
private:
// ── Asio path (no TLS) ───────────────────────────────────────────────────
// Asio path (no TLS)
void start_read();
void handle_length(std::error_code ec, std::size_t n);
void handle_body(uint32_t length, std::error_code ec, std::size_t n);
void do_send();
// ── TLS path ─────────────────────────────────────────────────────────────
// TLS path
void tls_read_loop();
void tls_drain_sends();
@@ -142,7 +140,7 @@ class TcpServerConn : public std::enable_shared_from_this<TcpServerConn> {
std::deque<std::vector<uint8_t>> tls_send_queue_;
};
// ── Server-side acceptor ─────────────────────────────────────────────────────
// Server-side acceptor
// Spawns a TcpServerConn (via factory) for each accepted TCP connection.
class TcpAcceptor {
public:
@@ -177,7 +175,7 @@ class TcpAcceptor {
std::vector<std::shared_ptr<TcpServerConn>> conns_;
};
// ── UDP media channel ────────────────────────────────────────────────────────
// UDP media channel
// Thin async UDP socket. send_to() is thread-safe. Recv callbacks fire on the
// io_context's thread (same thread that runs the io_context::run() loop).
class UdpMediaChannel {