Fix race condition in TestSocketCleanup by protecting listener access with mutex

Fixes bd-160

The race was between Start() writing s.listener and Stop() reading it.
Now all listener access is protected by the server mutex:
- Start() stores listener under lock after creation
- Accept loop reads listener under RLock
- Stop() closes listener under lock

All RPC tests now pass with -race flag.
This commit is contained in:
Steve Yegge
2025-10-19 09:14:37 -07:00
parent 91948f7a2b
commit 5aa7658433
4 changed files with 54 additions and 11 deletions

5
.gitignore vendored
View File

@@ -38,5 +38,10 @@ Thumbs.db
.beads/daemon.pid
.beads/bd.sock
# .beads directory files (keep JSONL only)
.beads/.gitignore
.beads/db.sqlite
.beads/bd.db
# Keep JSONL exports (source of truth for git)
!.beads/*.jsonl