Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions postgresql_proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def _create_pg_connection(self, address, context):
redirect_config = self.instance_config.redirect

pg_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
pg_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
pg_sock.connect((redirect_config.host, redirect_config.port))
pg_sock.setblocking(False)

Expand Down Expand Up @@ -130,6 +131,7 @@ def accept_wrapper(self, sock: socket.socket):

# Accept the raw connection
clientsocket, address = sock.accept()
clientsocket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
# On macOS, accepted sockets inherit O_NONBLOCK from the listening socket.
# SSL negotiation uses blocking recv, so we must set blocking explicitly here.
clientsocket.setblocking(True)
Expand Down
Loading