Commit a218603
fix: clamp negative msecs to -1 for waitForReadyRead() (#220)
## Summary
- Fix `waitForReadyRead()` silently failing when msecs is negative
## Problem
`QAbstractSocket::waitForReadyRead(int msecs)` treats any negative value
as
an error and returns `false` immediately. However, Qt6 defines `-1` as
the
"wait forever" sentinel.
In `writeConfirmedFrame()`, `msecs` is computed as
`(timeout - elapsed)`, which can become negative when elapsed exceeds
the
original timeout. This causes `sendMessage()` to silently fail.
## Fix
Clamp negative msecs to `-1`, which is the correct Qt6 "wait forever"
value.
This preserves the original intent: when the timeout budget is
exhausted,
block until data arrives rather than failing immediately.
## Test Plan
- [x] Logic verified: negative msecs now clamped to Qt6's -1 sentinel
- [x] Original issue reporter's fix confirmed as correct approach
- [x] No change to the positive msecs path
Fixes #194
Co-authored-by: Itay Grudev <itay+git2020@grudev.com>1 parent cb9a48e commit a218603
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
| 324 | + | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
| |||
0 commit comments