From 64ddb19a93c3fcaf4db6008408ae8d1175414143 Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Tue, 16 Jul 2019 09:41:37 -0700 Subject: [PATCH] client: fix canceled vs deadline exceeded double-check logic (#2906) --- internal/transport/http2_client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/transport/http2_client.go b/internal/transport/http2_client.go index c96178d7..9687ec7b 100644 --- a/internal/transport/http2_client.go +++ b/internal/transport/http2_client.go @@ -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 } }