Skip to content

Conversation

maitredede
Copy link

Like *net.Conn.Read() or *os.File.Read() when a timeout occurs, return an error that can be checked with os.IsTimeout()

@maitredede
Copy link
Author

The actual behavior is "return 0 without error", that can also be understood as "end of stream". Network connections and file reads have their own timeout errors that can be detected with os.IsTimeout().

@zeroZshadow
Copy link

This is exactly the issue i'm running into. I'm using io.ReadFull to fill a buffer directly from the port. However if a timeout is hit due to misconfiguration, it will loop forever.
Thanks for fixing this!

@cmaglie cmaglie added the 2.0 Breaking changes scheduled for v2.0 release label Nov 25, 2022
@quite
Copy link
Contributor

quite commented May 6, 2024

@maitredede do you have time to rebase this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think case Timeout:; return "Timeout" should also be added before default: (bcaab3f#diff-ad4fb56affb62e9f5024c32ea8a857376661813e1bc22b7dfef64f21ff16c34fR176)

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

@quite
Copy link
Contributor

quite commented May 6, 2024

@maitredede i you don't have time, i think i can take over with a new PR (keeping you as author of course).

@maitredede
Copy link
Author

Hello @quite, I have rebased/updated 😃

@quite
Copy link
Contributor

quite commented May 7, 2024

@maitredede great! I hope @cmaglie will get some time to look over this and merge it

@andradei
Copy link

This would be very useful to have as I'm testing various types of connections and all of them have timeouts except for my serial ones and this would fix it.

@andradei
Copy link

andradei commented Nov 20, 2024

@cmaglie sorry to ping you as you said, on another issue, that there is no timeline for adding timeouts in a possible 2.0 version several months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.0 Breaking changes scheduled for v2.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants