File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,18 +164,11 @@ def interrupt(self):
164164 """
165165 if self .__connection_result :
166166 self .__interrupted = True
167- self .__connection_result .close ()
168- self .__connection_result = None
167+ self ._close_current_connection ()
169168 self ._compute_next_retry_delay ()
170169
171170 def _close_current_connection (self ):
172- # Close the current connection before dropping it so a fault-driven reconnect tears
173- # the old connection down deterministically (on urllib3 2.x) rather than deferring to
174- # garbage collection. This is only reached after the read loop has ended (stream
175- # exhausted or errored), so the reader is not blocked mid-read and closing cannot
176- # deadlock. Capture into a local and guard for None in case interrupt() nulled it
177- # concurrently; ConnectionResult.close() is idempotent, so a later interrupt()/close()
178- # is safe.
171+ # Close and drop the current connection, if any.
179172 result = self .__connection_result
180173 self .__connection_result = None
181174 if result is not None :
You can’t perform that action at this time.
0 commit comments