diff --git a/hypercorn/protocol/h2.py b/hypercorn/protocol/h2.py index 48b8af61..fcfd6ecf 100755 --- a/hypercorn/protocol/h2.py +++ b/hypercorn/protocol/h2.py @@ -137,7 +137,9 @@ async def _handle_events(self, events: List[h2.events.Event]) -> None: del self.streams[event.stream_id] elif isinstance(event, h2.events.WindowUpdated): await self._window_updated(event.stream_id) - pass + elif isinstance(event, h2.events.RemoteSettingsChanged): + if h2.settings.SettingCodes.INITIAL_WINDOW_SIZE in event.changed_settings: + await self._window_updated(None) elif isinstance(event, h2.events.ConnectionTerminated): await self.send(Closed()) await self._flush() @@ -149,7 +151,7 @@ async def _flush(self) -> None: async def _send_data(self, stream_id: int, data: bytes) -> None: while True: - while not self.connection.local_flow_control_window(stream_id): + while self.connection.local_flow_control_window(stream_id) < 1: await self._wait_for_flow_control(stream_id) chunk_size = min(len(data), self.connection.local_flow_control_window(stream_id))