some ai powered fixes for #1473

This commit is contained in:
Flowseal committed 2026-10-30 18:34:32 +03:00
1 parent 7fb01a7d05
commit 44c5ee2a57
2 files changed
+41 -4

No files matched your search

+8 -4
View File
@@ -284,17 +284,21 @@ async def probe_appdata_len(domain: str, port: int = 443,
pass
client_hello = outgoing.read()
# Share one deadline across connecting, sending, and reading the flight.
loop = asyncio.get_running_loop()
deadline = loop.time() + timeout
reader, writer = await asyncio.wait_for(
asyncio.open_connection(domain, port), timeout=timeout)
writer.write(client_hello)
await writer.drain()
await asyncio.wait_for(writer.drain(), timeout=deadline - loop.time())
flight = bytearray()
loop = asyncio.get_running_loop()
deadline = loop.time() + timeout
while True:
remaining = deadline - loop.time()
if remaining <= 0:
raise asyncio.TimeoutError
chunk = await asyncio.wait_for(
reader.read(16384), timeout=max(0.1, deadline - loop.time()))
reader.read(16384), timeout=remaining)
if not chunk:
return None
flight.extend(chunk)