BUG-125 - Harden Client And Queue Lifetime Edges¶
Summary¶
Fix the concrete client and queue lifetime hazards found during the focused upload/download client review.
Findings To Address¶
CUpDownClient::TryToConnect()can enter the Kad buddy callback path with a buddy endpoint and no request file, then dereferencem_reqfile.CUploadQueue::DeleteAll()relies on a debug-only pending-I/O assertion before deleting upload queue entries.- A4AF source cleanup trusts raw client and part-file links without the stale pointer recovery used by normal source lists.
- Per-client file-pointer caches can retain removed
CPartFile *keys after a part file is stopped or deleted.
Scope¶
- Keep protocol semantics unchanged.
- Prefer local guards and cleanup over broad ownership rewrites.
- Keep each fix in a granular commit with targeted validation.
Acceptance Criteria¶
- [x] Kad buddy callback does not dereference a null request file.
- [x] Upload queue shutdown does not delete entries with pending disk I/O.
- [x] A4AF cleanup tolerates stale client/file links without dereferencing them.
- [x] File removal purges auxiliary per-client caches that key on the removed part file pointer.
- [x] Debug x64 and Release x64 app builds pass after the implementation.
Closure Evidence¶
App commits landed on emulebb/main:
c7567679BUG-125 guard Kad callback file hashdb20c32dBUG-125 retain pending upload entries on shutdowncd19a0e3BUG-125 validate A4AF cleanup pointersf6cbc7d5BUG-125 purge part file client history
Validation run for each app slice:
python -m emule_workspace validatepython -m emule_workspace build app --variant main --config Debug --platform x64 --build-output-mode ErrorsOnlypython -m emule_workspace build app --variant main --config Release --platform x64 --build-output-mode ErrorsOnly