client: fix canceled vs deadline exceeded double-check logic (#2906)

This commit is contained in:
Doug Fawley
2019-07-16 09:41:37 -07:00
committed by GitHub
parent 24b2fb8959
commit 64ddb19a93

View File

@ -978,9 +978,9 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) {
statusCode = codes.Unknown
}
if statusCode == codes.Canceled {
// Our deadline was already exceeded, and that was likely the cause of
// this cancelation. Alter the status code accordingly.
if d, ok := s.ctx.Deadline(); ok && d.After(time.Now()) {
if d, ok := s.ctx.Deadline(); ok && !d.After(time.Now()) {
// Our deadline was already exceeded, and that was likely the cause
// of this cancelation. Alter the status code accordingly.
statusCode = codes.DeadlineExceeded
}
}