Skip to content

Commit

Permalink
Fix #2698: set write buffer limit to zero on client and server
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Mar 22, 2018
1 parent 39831ca commit 98e96f7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/2698.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set write buffer limit to zero for both client and server.
1 change: 1 addition & 0 deletions aiohttp/client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def is_connected(self):

def connection_made(self, transport):
self.transport = transport
transport.set_write_buffer_limits(0)

def connection_lost(self, exc):
if self._payload_parser is not None:
Expand Down
1 change: 1 addition & 0 deletions aiohttp/web_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def connection_made(self, transport):
super().connection_made(transport)

self.transport = transport
transport.set_write_buffer_limits(0)

if self._tcp_keepalive:
tcp_keepalive(transport)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,10 @@ async def test_empty_data(loop):
proto.data_received(b'')

# do nothing


async def test_disable_write_buffer(loop):
proto = ResponseHandler(loop=loop)
transport = mock.Mock()
proto.connection_made(transport)
transport.set_write_buffer_limits.assert_called_with(0)
4 changes: 4 additions & 0 deletions tests/test_web_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,3 +817,7 @@ def test_two_data_received_without_waking_up_start_task(srv, loop):

assert len(srv._messages) == 2
assert srv._waiter.done()


def test_disable_write_buffer(srv):
srv.transport.set_write_buffer_limits.assert_called_with(0)

0 comments on commit 98e96f7

Please sign in to comment.