Commit 8673e04
fix(daemon): fail clearly if listenAvoidingBlockedPorts exhausts all retries
The retry loop only exited via return (bound a usable port) or throw (non-fallback bind error).
If it ever exhausted all 5 attempts it fell through returning undefined with the server closed/
unbound, and the caller (startDaemonServer → getBoundPort) then threw the misleading "Daemon server
is not listening on a TCP port." Add an explicit, descriptive throw after the loop.
Not reachable in practice — the first fallback sets port=0 and OS ephemeral ports (>=32768) are
never in FETCH_BLOCKED_PORTS (all <=10080), so iteration 2 always binds — but the silent fall-through
is fragile (a future change to the blocked set or retry count would make it a real crash with a
confusing error). TDD test forces the exhaustion path and asserts the clear throw.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c0a9010 commit 8673e04
2 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
0 commit comments