Commit aa75e5c
Honor --timeout precisely with non-blocking recv polling (#42)
The wait loop polled every rx_stack with recv(block=True, timeout=0.01).
With ~249 stacks per sweep (11bits functional, 29bits broadcast) the
user-supplied --timeout was effectively rounded up to a multiple of
~2.5 seconds; --timeout 1 did not bound the wait at one second.
Switch to recv(block=False) with a 1 ms sleep between sweeps. An empty
sweep over 249 stacks now takes microseconds and the deadline is
honored within ~1 ms granularity. No semantic change to message
handling: recv(block=False) returns exactly the same payloads as the
blocking form when data is available.
Also: time.time() -> time.monotonic() for the duration measurement
(immune to wall-clock adjustments), drop the now-redundant `waiting`
sentinel in favor of `payload is None`, and remove the `# TODO: #42`
marker now that this change resolves it.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent fbab757 commit aa75e5c
1 file changed
Lines changed: 19 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
280 | 277 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
| |||
0 commit comments