Open maitredede opened 2 years ago
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()
.
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!
@maitredede do you have time to rebase this?
@maitredede i you don't have time, i think i can take over with a new PR (keeping you as author of course).
Hello @quite, I have rebased/updated :smiley:
@maitredede great! I hope @cmaglie will get some time to look over this and merge it
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.
Like
*net.Conn.Read()
or*os.File.Read()
when a timeout occurs, return an error that can be checked withos.IsTimeout()