Skip to content

Commit

Permalink
close listener connection on TimedOut and BrokerPipe errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DXist committed Dec 20, 2024
1 parent 9f6ea96 commit 3c0d561
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sqlx-postgres/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3c0d561

Please sign in to comment.