Skip to content

Commit c10d08f

Browse files
committed
Fix a race between transport waiter and connection_made
1 parent b2af6b0 commit c10d08f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

uvloop/handles/basetransport.pyx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ cdef class UVBaseTransport(UVSocketHandle):
126126
raise RuntimeError(
127127
'protocol is not set, cannot call connection_made()')
128128

129+
if self._closing:
130+
# A connection waiter can be cancelled between
131+
# 'await loop.create_connection()' and
132+
# `_schedule_call_connection_made` and
133+
# the actual `_call_connection_made`.
134+
self._wakeup_waiter()
135+
return
136+
129137
_loop_ready_len = self._loop._ready_len
130138

131139
# Set _protocol_connected to 1 before calling "connection_made":

0 commit comments

Comments
 (0)