But it gets downloaded at line 185 `res = request(cmd,uri)` unless that request fails.

All the logic around downhost/sleeping/wait_linux_payload has nothing to do with the file being created?