Skip to content

Commit 787cec8

Browse files
bitcoin3usRichard Taylorclaude
authored
Add connection timeout to DownloadManager session.get() (#98)
The HTTP connection (session.get) had no timeout, only individual chunk reads did. If the TCP connection or TLS handshake stalled, the entire async balance fetch loop would hang forever. This was observed on ESP32 devices where intermittent WiFi issues caused session.get() to never return, freezing the wallet UI on "Connecting to backend". Uses the existing _CHUNK_TIMEOUT_SECONDS (10s) for the connection timeout. Co-authored-by: Richard Taylor <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent eb79079 commit 787cec8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal_filesystem/lib/mpos/net/download_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def _download_url_async(cls, url, outfile=None, total_size=None,
114114
if headers is None:
115115
headers = {}
116116

117-
async with session.get(url, headers=headers, ssl=sslctx) as response:
117+
async with session.get(url, headers=headers, ssl=sslctx, timeout=_CHUNK_TIMEOUT_SECONDS) as response:
118118
if response.status < 200 or response.status >= 400:
119119
print(f"DownloadManager: HTTP error {response.status}")
120120
raise RuntimeError(f"HTTP {response.status}")

0 commit comments

Comments
 (0)