Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/socket_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ void socket_worker(const SocketBenchConfig& cfg, std::atomic<bool>& stop, Socket
const bool recv_done = !cfg.receive || stats.received_packets >= static_cast<uint64_t>(cfg.iterations);
if (send_done && recv_done) { break; }

if (cfg.send && !send_done) {
// UDP servers must learn the peer address from an inbound packet before
// they can transmit, so withhold the server's first send until at least
// one RX packet has arrived. The client always transmits eagerly.
const bool waiting_for_peer = cfg.server && cfg.receive && stats.received_packets == 0;

if (cfg.send && !send_done && !waiting_for_peer) {
auto* msg = daqiri::create_tx_burst_params();
daqiri::set_header(msg, port, queue, 1, 1);

Expand Down
6 changes: 5 additions & 1 deletion src/managers/socket/daqiri_socket_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,10 @@ bool SocketMgr::send_udp_burst(EndpointState& ep, BurstParams* burst, size_t* se
if (ep.socket_cfg.mode_ == SocketMode::SERVER) {
std::lock_guard<std::mutex> lock(state_mutex_);
if (!ep.udp_peer_valid) {
DAQIRI_LOG_ERROR("UDP server has no learned peer yet; cannot transmit");
if (!ep.udp_peer_missing_logged) {
DAQIRI_LOG_DEBUG("UDP server has no learned peer yet; cannot transmit");
ep.udp_peer_missing_logged = true;
}
Comment on lines +743 to +745
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Doc-sync required for src/managers/socket/ changes

Per the doc-sync rule, any change under src/managers/*/ must be accompanied by updates to docs/getting-started.md, docs/configuration.md, docs/tutorials/configuration-walkthrough.md, README.md (Backends section), and AGENTS.md. The demoted log level (ERROR → DEBUG) and the new udp_peer_missing_logged latch are observable by operators who monitor spdlog output — a misconfigured one-way server will now emit a single DEBUG line rather than repeated ERROR lines. Please update the relevant docs in this PR.

Rule Used: DAQIRI has no automated doc-sync gate beyond mkdoc... (source)

return false;
}
peer = ep.udp_peer_addr;
Expand Down Expand Up @@ -1285,6 +1288,7 @@ void SocketMgr::udp_rx_loop(int if_index) {
std::lock_guard<std::mutex> lock(state_mutex_);
ep->udp_peer_addr = peers[static_cast<size_t>(received - 1)];
ep->udp_peer_valid = true;
ep->udp_peer_missing_logged = false;
}

for (int i = 0; i < received; ++i) {
Expand Down
1 change: 1 addition & 0 deletions src/managers/socket/daqiri_socket_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class SocketMgr : public Manager {
std::shared_ptr<RxQueueState> rx_queue_state;
sockaddr_in udp_peer_addr{};
bool udp_peer_valid = false;
bool udp_peer_missing_logged = false;
uintptr_t primary_conn_id = 0;
};

Expand Down