Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Achille Roussel committed May 31, 2017
1 parent b7b4c1f commit bb52187
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ func (c *Conn) ReadAt(b []byte, offset int64) (int, int64, error) {
if n > len(b) {
n, err = len(b), io.ErrShortBuffer
} else if n == 0 && time.Now().After(adjustedDeadline) {
// Because we use the adjusted deadline we could end up returning
// before the actual deadline occurred. This is necessary otherwise
// timing out the connection for read could end up leaving it in an
// unpredictable state, which would require closing it.
// This design decision was main to maximize the changes of keeping
// the connection open, the trade off being to lose precision on the
// read deadline management.
err = RequestTimedOut
}
}
Expand Down

0 comments on commit bb52187

Please sign in to comment.