Skip to content

Commit f53c70e

Browse files
committed
reduce peek bytes length
1 parent 87fa1ae commit f53c70e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

utils/localstack_extensions/utils/tcp_protocol_router.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def patch_gateway_for_tcp_routing():
6464
LOG.debug("Gateway already patched for TCP routing")
6565
return
6666

67-
LOG.info("Patching LocalStack gateway for TCP protocol detection")
67+
LOG.debug("Patching LocalStack gateway for TCP protocol detection")
68+
peek_bytes_length = 32
6869

6970
# Patch HTTPChannel to use our protocol-detecting version
7071
@patch(HTTPChannel.__init__)
@@ -75,7 +76,7 @@ def _patched_init(fn, self, *args, **kwargs):
7576
self._detection_buffer = []
7677
self._detecting = True
7778
self._tcp_peer = None
78-
self._detection_buffer_size = 512
79+
self._detection_buffer_size = peek_bytes_length
7980

8081
@patch(HTTPChannel.dataReceived)
8182
def _patched_dataReceived(fn, self, data):
@@ -122,7 +123,7 @@ def _patched_dataReceived(fn, self, data):
122123
continue
123124

124125
# No extension claimed the connection
125-
buffer_size = getattr(self, "_detection_buffer_size", 512)
126+
buffer_size = getattr(self, "_detection_buffer_size", peek_bytes_length)
126127
if len(buffered_data) >= buffer_size:
127128
LOG.debug("No TCP extension matched, using HTTP handler")
128129
self._detecting = False

0 commit comments

Comments
 (0)