From 0ef28b2a4544aba697ab823d453834b75367981f Mon Sep 17 00:00:00 2001 From: Benjamin Simon Date: Thu, 30 May 2024 19:40:10 +0300 Subject: [PATCH 1/2] fix partial send --- postgresql_proxy/proxy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/postgresql_proxy/proxy.py b/postgresql_proxy/proxy.py index 2cb6c39..1417db9 100644 --- a/postgresql_proxy/proxy.py +++ b/postgresql_proxy/proxy.py @@ -181,9 +181,10 @@ def service_connection(self, key: SelectorKeyProxy, mask): next_conn = conn.redirect_conn if next_conn and next_conn.out_bytes: try: - LOG.debug('sending to %s:\n%s', next_conn.name, next_conn.out_bytes) - sent = next_conn.sock.send(next_conn.out_bytes) - next_conn.sent(sent) + while next_conn.out_bytes: + LOG.debug('sending to %s:\n%s', next_conn.name, next_conn.out_bytes) + sent = next_conn.sock.send(next_conn.out_bytes) + next_conn.sent(sent) except OSError: # If one side is closed, close the other one # this can happen in the case where the client disconnects, and postgres still return a response From 033f27c7c493ebcb5c92627585f92bc1d741c71b Mon Sep 17 00:00:00 2001 From: Benjamin Simon Date: Thu, 30 May 2024 19:47:10 +0300 Subject: [PATCH 2/2] update version --- README.md | 4 +++- setup.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37be86d..23aec31 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ If you want to test it, do this. Otherwise scroll down for instructions on how t ### Changelog +- v0.2.1 + - Fix partial send of outbound packets [#8](https://github.com/localstack/postgresql-proxy/pull/8) - v0.2.0 - Add support for intercepting [ParameterStatus](https://www.postgresql.org/docs/current/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARAMETERSTATUS) responses from Postgres [#7](https://github.com/localstack/postgresql-proxy/pull/7) - v0.1.2 @@ -74,4 +76,4 @@ If you want to test it, do this. Otherwise scroll down for instructions on how t - v0.0.3 - add stop() method to proxy; refactor logging - v0.0.2 - - fix socket file descriptors under Linux \ No newline at end of file + - fix socket file descriptors under Linux diff --git a/setup.py b/setup.py index cf77305..941180e 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='postgresql-proxy', - version='0.2.0', + version='0.2.1', description='Postgresql Proxy', packages=find_packages(exclude=('tests', 'tests.*')), install_requires=install_requires,