mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 06:00:33 +02:00
Interrupt stalled downloads on Windows too
shutdown() from another thread doesn't wake a blocked recv on Windows, so quitting mid-download waited out the 4 s deadline there (CI's Windows server tests). Close the handle as well, detached first so the worker's own close can't hit a reused handle. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1cd839e0f1
commit
b86dd3b07d
1 file changed
+8
@@ -373,6 +373,14 @@ def abort(conn):
|
|||||||
sock.shutdown(socket.SHUT_RDWR)
|
sock.shutdown(socket.SHUT_RDWR)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
if os.name == "nt":
|
||||||
|
# Windows doesn't wake a recv blocked in another thread on shutdown(),
|
||||||
|
# only when the handle closes. detach() first, so the owner's later
|
||||||
|
# close() can't close a handle the OS has since given to someone else.
|
||||||
|
try:
|
||||||
|
socket.close(sock.detach())
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def download(p, dest_dir, progress=None, cancelled=None, connected=None):
|
def download(p, dest_dir, progress=None, cancelled=None, connected=None):
|
||||||
|
|||||||
Reference in new issue
Block a user