Commit 645019e
committed
fix(download): add per-chunk timeout and retry to prevent deadlock
When a chunk response is lost in transit (e.g., REM layer drops the
connection mid-transfer), recvSpite blocked indefinitely waiting for
the chunk that would never arrive. The implant was also stuck waiting
for the next chunk request, creating a mutual deadlock that only
resolved after session_dead fired (~4 minutes later).
Add a 30s per-chunk timeout using a select on time.After(MinTimeout).
On timeout, resend the current chunk request to the implant. After
maxChunkRetries (3) consecutive timeouts for the same chunk, return
an error so the task fails fast rather than hanging silently.
Retries counter resets to 0 on each successful chunk receipt, so
transient single-packet loss does not consume retry budget.1 parent 1cb86eb commit 645019e
1 file changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
345 | 348 | | |
346 | 349 | | |
347 | 350 | | |
| 351 | + | |
348 | 352 | | |
349 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
350 | 372 | | |
351 | 373 | | |
352 | 374 | | |
| |||
0 commit comments