Skip to content

Commit eef8eda

Browse files
sorcioambv
authored andcommitted
remove _SendfileFallbackProtocol requirement of _FlowControlMixin
1 parent b5a7b55 commit eef8eda

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎Lib/asyncio/base_events.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,14 @@ def _check_ssl_socket(sock):
209209

210210
class _SendfileFallbackProtocol(protocols.Protocol):
211211
def __init__(self, transp):
212-
if not isinstance(transp, transports._FlowControlMixin):
213-
raise TypeError("transport should be _FlowControlMixin instance")
214212
self._transport = transp
215213
self._proto = transp.get_protocol()
216214
self._should_resume_reading = transp.is_reading()
217-
self._should_resume_writing = transp._protocol_paused
215+
216+
# should we expect a call to resume_writing?
217+
_, high_water = transp.get_write_buffer_limits()
218+
self._should_resume_writing = transp.get_write_buffer_size() > high_water
219+
218220
transp.pause_reading()
219221
transp.set_protocol(self)
220222
if self._should_resume_writing:

0 commit comments

Comments
 (0)