Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close listener connection on TimedOut and BrokerPipe errors #3648

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DXist
Copy link
Contributor

@DXist DXist commented Dec 20, 2024

This PR handles TimedOut and BrokerPipe errors that could be returned by tcp layer:

EPIPE  The other end closed the socket unexpectedly or a read is
              executed on a shut down socket.

ETIMEDOUT
      The other end didn't acknowledge retransmitted data after
      some time.

In these cases it makes sense to close listener connection proactively.

Comment on lines 282 to 286
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) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using matches! may make this section a bit cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the expression using matches! macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants