Skip to content

Timeout : return an error compatible with os.IsTimeout()#118

Open
maitredede wants to merge 1 commit into
bugst:masterfrom
maitredede:timeouts
Open

Timeout : return an error compatible with os.IsTimeout()#118
maitredede wants to merge 1 commit into
bugst:masterfrom
maitredede:timeouts

Conversation

@maitredede

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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

quite commented May 6, 2024

Copy link
Copy Markdown
Contributor

@maitredede do you have time to rebase this?

Comment thread serial.go

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done

@quite

quite commented May 6, 2024

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Author

Hello @quite, I have rebased/updated 😃

@quite

quite commented May 7, 2024

Copy link
Copy Markdown
Contributor

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

@andradei

Copy link
Copy Markdown

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

andradei commented Nov 20, 2024

Copy link
Copy Markdown

@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.

@ddibiasi

Copy link
Copy Markdown

What is the status of this? As timeouts are not respected, as highlighted by #141 (comment).

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.

6 participants