Skip to content

daemon: a datagram send the client can get an answer to - #494

Merged
TeoSlayer merged 1 commit into
mainfrom
fix/dgram-send-error
Oct 1, 2026
Merged

TeoSlayer merged 1 commit into
mainfrom
fix/dgram-send-error

Conversation

@TeoSlayer

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

SendTo over IPC is fire-and-forget: the daemon logs a failed datagram and the client is told nothing. In a lab, 1,617 sends failed inside the daemon (ephemeral ports exhausted) while every pilotctl dgram exited 0. The daemon cannot simply start replying: the IPC envelope has no request ID, and an existing driver hands any error frame to whichever unrelated request it has in flight.

Changes

  • New opcode pair CmdSendToConfirm (0x39) / CmdSendToOK (0x3A): the same payload as CmdSendTo, dispatched inline so datagrams keep their order, answered with OK once the datagram is handed to the tunnel or CmdError with the cause.
  • dgram_confirm is listed in the info reply's features.
  • Legacy CmdSendTo is unchanged and still silent, so existing drivers behave exactly as before.

This is the daemon half. The driver method is in pilot-protocol/common (feat/dgram-confirm); pilotctl dgram switches to it in a follow-up once that is released.

Test Plan

  • go build ./..., go vet ./..., unit suite with GOWORK=off
  • TestIPCSendToConfirmRepliesWithOutcome (unit), TestSendToConfirmReportsDaemonSendFailure (integration, raw frames)
  • Tested with the new driver against this daemon (live peer confirmed and delivered; missing node returns the resolve error) and against a daemon without the handler (falls back, reported unconfirmed)
  • Full go test -parallel 4 -count=1 ./tests/: one failure, TestManualSnapshotTrigger, which uses fixed port 127.0.0.1:18080; another process on the test machine was listening there, and the test fails the same way on a clean main checkout

Checklist

  • New code includes the SPDX license header
  • go.mod / go.sum unchanged
  • CHANGELOG updated

🤖 Generated with Claude Code

CmdSendTo is fire-and-forget: a failed send is only logged, so pilotctl
dgram and Driver.SendTo report success for datagrams the daemon never sent.
It cannot start replying — the IPC envelope has no request ID, and existing
drivers deliver any CmdError to whichever request they have in flight.

Add an opt-in pair, CmdSendToConfirm (0x39) / CmdSendToOK (0x3A): same
payload, dispatched inline like CmdSendTo so datagrams keep their order,
replying OK once the datagram is handed to the tunnel or CmdError with the
cause. Advertised as the dgram_confirm feature in the info reply. CmdSendTo
is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TeoSlayer
TeoSlayer merged commit 72f1918 into main Oct 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant