Skip to content

Commit

Permalink
internal/transport: do not mask ConnectionError (#4561) (#4572)
Browse files Browse the repository at this point in the history
Cherry pick #4561 to v1.38.x branch
Co-authored-by: Vicent Martí <42793+vmg@users.noreply.github.com>
  • Loading branch information
zasweq committed Jun 29, 2021
1 parent a73bd17 commit 5239cdb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/transport/http2_client.go
Expand Up @@ -878,12 +878,18 @@ func (t *http2Client) Close(err error) {
// Append info about previous goaways if there were any, since this may be important
// for understanding the root cause for this connection to be closed.
_, goAwayDebugMessage := t.GetGoAwayReason()

var st *status.Status
if len(goAwayDebugMessage) > 0 {
err = fmt.Errorf("closing transport due to: %v, received prior goaway: %v", err, goAwayDebugMessage)
st = status.Newf(codes.Unavailable, "closing transport due to: %v, received prior goaway: %v", err, goAwayDebugMessage)
err = st.Err()
} else {
st = status.New(codes.Unavailable, err.Error())
}

// Notify all active streams.
for _, s := range streams {
t.closeStream(s, err, false, http2.ErrCodeNo, status.New(codes.Unavailable, err.Error()), nil, false)
t.closeStream(s, err, false, http2.ErrCodeNo, st, nil, false)
}
if t.statsHandler != nil {
connEnd := &stats.ConnEnd{
Expand Down

0 comments on commit 5239cdb

Please sign in to comment.