Skip to content

Commit

Permalink
Disable nagle on whois sockets (#218)
Browse files Browse the repository at this point in the history
This incorporates #194 with a fixed unit test.
  • Loading branch information
troy2914 authored and mxsasha committed Apr 29, 2019
1 parent 2c63ffc commit e033ad4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions irrd/server/whois/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def connectionMade(self) -> None: # noqa: N802
self.transport.loseConnection()
return

# disable nagle
self.transport.setTcpNoDelay(True)

self.peer_str = f'[{peer.host}]:{peer.port}'

self.query_parser = WhoisQueryParser(peer, self.peer_str)
Expand Down
3 changes: 2 additions & 1 deletion irrd/server/whois/tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def test_whois_protocol_access_list_permitted(self, config_override, mock_pipeli
receiver.factory = mock_factory

receiver.connectionMade()
assert len(mock_transport.mock_calls) == 0
# with setTcpNoDelay(True) this should be 1
assert len(mock_transport.mock_calls) == 1

def test_whois_protocol_access_list_denied(self, config_override):
config_override({
Expand Down

0 comments on commit e033ad4

Please sign in to comment.