mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
close listener connection on TimedOut and BrokenPipe errors (#3648)
* close listener connection on TimedOut and BrokerPipe errors * use matches macro to generate jump table instead of chain of conditions
This commit is contained in:
parent
fdd4663318
commit
4590b9c3ee
@ -279,8 +279,14 @@ impl PgListener {
|
|||||||
// The connection is dead, ensure that it is dropped,
|
// The connection is dead, ensure that it is dropped,
|
||||||
// update self state, and loop to try again.
|
// update self state, and loop to try again.
|
||||||
Err(Error::Io(err))
|
Err(Error::Io(err))
|
||||||
if (err.kind() == io::ErrorKind::ConnectionAborted
|
if matches!(
|
||||||
|| err.kind() == io::ErrorKind::UnexpectedEof) =>
|
err.kind(),
|
||||||
|
io::ErrorKind::ConnectionAborted |
|
||||||
|
io::ErrorKind::UnexpectedEof |
|
||||||
|
// see ERRORS section in tcp(7) man page (https://man7.org/linux/man-pages/man7/tcp.7.html)
|
||||||
|
io::ErrorKind::TimedOut |
|
||||||
|
io::ErrorKind::BrokenPipe
|
||||||
|
) =>
|
||||||
{
|
{
|
||||||
if let Some(mut conn) = self.connection.take() {
|
if let Some(mut conn) = self.connection.take() {
|
||||||
self.buffer_tx = conn.inner.stream.notifications.take();
|
self.buffer_tx = conn.inner.stream.notifications.take();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user