Compare commits

...

4 Commits

Author SHA1 Message Date
Bojan Serafimov
7342088fcc Add todo 2022-01-18 16:39:04 -05:00
Bojan Serafimov
2e4307cfe5 Merge branch 'main' into proxy-health-check 2022-01-18 15:31:16 -05:00
Bojan Serafimov
fceb428878 Fix logic 2022-01-18 15:30:33 -05:00
Bojan Serafimov
1e717b5414 Don't error on health check 2022-01-18 15:15:38 -05:00
2 changed files with 12 additions and 2 deletions

View File

@@ -186,14 +186,24 @@ impl ProxyConnection {
fn handle_startup(&mut self) -> anyhow::Result<Option<(String, String)>> {
let have_tls = self.pgb.tls_config.is_some();
let mut encrypted = false;
let mut received_something = false;
loop {
let msg = match self.pgb.read_message()? {
Some(Fe::StartupPacket(msg)) => msg,
None => bail!("connection is lost"),
None => {
if received_something {
bail!("connection is lost");
} else {
// Probably load balancer health check
// TODO check peer_addr to make sure.
return Ok(None);
}
}
bad => bail!("unexpected message type: {:?}", bad),
};
println!("got message: {:?}", msg);
received_something = true;
match msg {
FeStartupPacket::GssEncRequest => {