Stopping the DNSCrypt UDP listener logs no receive warning #290

Merged
claude merged 1 commit from feature/22-dnscrypt-stop-warning into develop 2026-11-05 06:08:36 -05:00
Owner

Stopping the DNSCrypt UDP listener no longer logs "Error receiving a DNSCrypt UDP datagram." as a Warning.

  • DnsCryptUdpListener.StopAsync clears IsListening before it closes the sockets, and the stopping token is cancelled only afterwards. The receive loop therefore now treats a SocketException as the stop when IsListening is false, the same rule and comment as UdpDnsListener. A socket error while still listening is still logged.
  • New guard test StopAsync_WhileReceiveLoopsArePending_LogsNoWarning in DnsCryptUdpReceiveTests.

Evidence: the race is real but rare. A temporary loop of 50 cycles (query, reply, stop) was run five times on each side. It logged 4 warnings in 250 cycles before the fix and 0 in 250 after. The single-stop guard test therefore rarely fails on unfixed code. The verifier confirmed it passes on the parent. That is a guard, as the issue expected.

Tests: Ninlil.Dns.Protocol.DnsCrypt.Tests passes 54 of 54, five runs by the coder and three by the verifier. The verifier passed the change.

Closes #22

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

Stopping the DNSCrypt UDP listener no longer logs "Error receiving a DNSCrypt UDP datagram." as a Warning. - `DnsCryptUdpListener.StopAsync` clears `IsListening` before it closes the sockets, and the stopping token is cancelled only afterwards. The receive loop therefore now treats a `SocketException` as the stop when `IsListening` is false, the same rule and comment as `UdpDnsListener`. A socket error while still listening is still logged. - New guard test `StopAsync_WhileReceiveLoopsArePending_LogsNoWarning` in `DnsCryptUdpReceiveTests`. Evidence: the race is real but rare. A temporary loop of 50 cycles (query, reply, stop) was run five times on each side. It logged 4 warnings in 250 cycles before the fix and 0 in 250 after. The single-stop guard test therefore rarely fails on unfixed code. The verifier confirmed it passes on the parent. That is a guard, as the issue expected. Tests: `Ninlil.Dns.Protocol.DnsCrypt.Tests` passes 54 of 54, five runs by the coder and three by the verifier. The verifier passed the change. Closes #22 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Stopping the DNSCrypt UDP listener no longer logs a receive warning
Some checks failed
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Pipeline (push) Failing after 0s
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Test .NET (push) Failing after 6m52s
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Stage Draft Release (push) Has been skipped
Build / Build and Push Image (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (push) Has been skipped
Build / Pack and Push NuGet Packages (common) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (push) Has been skipped
Build / Publish Release (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (push) Has been skipped
Build / Build Binary (linux-amd64) (push) Has been skipped
Build / Build Binary (macos-amd64) (push) Has been skipped
Build / Pipeline (pull_request) Failing after 0s
Build / Build Binary (macos-arm64) (push) Has been skipped
Build / Build Binary (windows-amd64) (push) Has been skipped
Build / Build Arch Linux Packages (push) Has been skipped
Build / Smoke Test the Windows Binary (push) Has been skipped
Build / Build and Push Image (push) Has been skipped
Build / Build and Test Deb and RPM Packages (push) Has been skipped
Build / Publish Release (push) Has been skipped
01531281ee
Closes #22

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 6a4487ef6a into develop 2026-11-05 06:08:36 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!290
No description provided.