From 9d5f968c812f37241fbe0beb3f0573e84e7f953f Mon Sep 17 00:00:00 2001 From: hellower Date: Mon, 28 Aug 2023 15:20:13 +0900 Subject: [PATCH] Update client.rs https://github.com/postgresml/pgcat/pull/562 --- src/client.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index 8ad0d47b..073cb407 100644 --- a/src/client.rs +++ b/src/client.rs @@ -117,7 +117,15 @@ pub async fn client_entrypoint( log_client_connections: bool, ) -> Result<(), Error> { // Figure out if the client wants TLS or not. - let addr = stream.peer_addr().unwrap(); + let addr = match stream.peer_addr() { + Ok(addr) => addr, + Err(err) => { + return Err(Error::SocketError(format!( + "Failed to get peer address: {:?}", + err + ))); + } + }; match get_startup::(&mut stream).await { // Client requested a TLS connection.