From 3c0d561c4313e9c4b9589b38125d8be9bf8872b7 Mon Sep 17 00:00:00 2001 From: Rinat Shigapov Date: Fri, 20 Dec 2024 09:09:41 +0300 Subject: [PATCH] close listener connection on TimedOut and BrokerPipe errors --- sqlx-postgres/src/listener.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sqlx-postgres/src/listener.rs b/sqlx-postgres/src/listener.rs index b50003b4e4..ca245058af 100644 --- a/sqlx-postgres/src/listener.rs +++ b/sqlx-postgres/src/listener.rs @@ -280,7 +280,10 @@ impl PgListener { // update self state, and loop to try again. Err(Error::Io(err)) if (err.kind() == io::ErrorKind::ConnectionAborted - || err.kind() == io::ErrorKind::UnexpectedEof) => + || err.kind() == io::ErrorKind::UnexpectedEof + // see ERRORS section in tcp(7) man page (https://man7.org/linux/man-pages/man7/tcp.7.html) + || err.kind() == io::ErrorKind::TimedOut + || err.kind() == io::ErrorKind::BrokenPipe) => { if let Some(mut conn) = self.connection.take() { self.buffer_tx = conn.inner.stream.notifications.take();