|
19 | 19 | from h2.config import H2Configuration
|
20 | 20 | from h2.connection import H2Connection
|
21 | 21 | from h2.events import (
|
22 |
| - ConnectionTerminated, DataReceived, RequestReceived, StreamEnded, |
23 |
| - StreamReset, WindowUpdated |
| 22 | + ConnectionTerminated, DataReceived, RemoteSettingsChanged, |
| 23 | + RequestReceived, StreamEnded, StreamReset, WindowUpdated |
24 | 24 | )
|
25 | 25 | from h2.errors import ErrorCodes
|
26 | 26 | from h2.exceptions import ProtocolError, StreamClosedError
|
| 27 | +from h2.settings import SettingCodes |
27 | 28 |
|
28 | 29 |
|
29 | 30 | RequestData = collections.namedtuple('RequestData', ['headers', 'data'])
|
@@ -68,6 +69,9 @@ def data_received(self, data: bytes):
|
68 | 69 | self.stream_reset(event.stream_id)
|
69 | 70 | elif isinstance(event, WindowUpdated):
|
70 | 71 | self.window_updated(event.stream_id, event.delta)
|
| 72 | + elif isinstance(event, RemoteSettingsChanged): |
| 73 | + if SettingCodes.INITIAL_WINDOW_SIZE in event.changed_settings: |
| 74 | + self.window_updated(None, 0) |
71 | 75 |
|
72 | 76 | self.transport.write(self.conn.data_to_send())
|
73 | 77 |
|
@@ -132,7 +136,7 @@ async def send_data(self, data, stream_id):
|
132 | 136 | Send data according to the flow control rules.
|
133 | 137 | """
|
134 | 138 | while data:
|
135 |
| - while not self.conn.local_flow_control_window(stream_id): |
| 139 | + while self.conn.local_flow_control_window(stream_id) < 1: |
136 | 140 | try:
|
137 | 141 | await self.wait_for_flow_control(stream_id)
|
138 | 142 | except asyncio.CancelledError:
|
|
0 commit comments