Skip to content

Commit

Permalink
Fix future issue in sock_connect()
Browse files Browse the repository at this point in the history
CPython fixed the same issue in python/cpython#10419. Seems like under
pressure, more write callbacks may happen before _remove_writer() is
called, so we should check for done().

Fixes MagicStack#378
  • Loading branch information
fantix committed Feb 9, 2021
1 parent 8c471f8 commit 0360dab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,8 @@ cdef class Loop:
return fut

cdef _sock_connect_cb(self, fut, sock, address):
if fut.cancelled():
if fut.done():
# Refs #378: this may be called multiple times.
return

try:
Expand Down

0 comments on commit 0360dab

Please sign in to comment.