From 2171a9dc2d8a3b4f631f8e22a8306c9667f33ade Mon Sep 17 00:00:00 2001 From: Folke Behrens Date: Fri, 13 Sep 2024 10:04:20 +0100 Subject: [PATCH] Add client-compute passthrough --- proxy/src/bin/pglb.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/proxy/src/bin/pglb.rs b/proxy/src/bin/pglb.rs index d671553ec0..0cd2c727b9 100644 --- a/proxy/src/bin/pglb.rs +++ b/proxy/src/bin/pglb.rs @@ -582,7 +582,28 @@ struct ComputePassthrough { impl PglbConn { async fn handle_compute_passthrough(self) -> Result> { - todo!() + let ComputePassthrough { + mut client_stream, + mut compute_stream, + } = self.state; + + loop { + select! { + msg = client_stream.next() => { + let Some(msg) = msg else { + bail!("compute disconnected"); + }; + compute_stream.send(msg?).await?; + } + + msg = compute_stream.next() => { + let Some(msg) = msg else { + bail!("compute disconnected"); + }; + client_stream.send(msg?).await?; + } + } + } } }