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

switch the connection lost from string check to error type check. #27

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

jeremyforan
Copy link
Contributor

Previously the code, is checking for an error string containing "i/o timeout" to handle connection loss. However, the error message "read: operation timed out" does not match the check.

To address this, I modified the error checking to cover more cases. Instead of looking for a specific error string, check for a timeout is using the net.Error interface and its Timeout() method. This approach is generally more reliable and less prone to breakage if the error messages change.

#26 (comment)

The error message you're receiving, "read tcp 172.20.5.102:50478->15.223.11.251:443: read: operation timed out", indicates a timeout error. This error is typically generated by the underlying Go net library when a network operation exceeds its deadline. In your case, it appears to be a read operation on a TCP connection.

Previousy the code,is checking for an error string containing "i/o timeout" to handle connection loss. However, the error message "read: operation timed out" does not match the check.

To address this, I modified the error checking to cover more cases. Instead of looking for a specific error string, check for a timeout is using the net.Error interface and its Timeout() method. This approach is generally more reliable and less prone to breakage if the error messages change.
@jeremyforan jeremyforan changed the title switch the connection lost from string check to error type check. label:enhancement switch the connection lost from string check to error type check. Jan 5, 2024
@jeremyforan jeremyforan changed the title label:enhancement switch the connection lost from string check to error type check. switch the connection lost from string check to error type check. Jan 5, 2024
@KazuhitoNakamura
Copy link
Collaborator

Hello, @jeremyforan.

Thank you for your Pull Request.
I too feel your approach is so appropriate.
Please let me merge it.

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