mirror of https://github.com/grpc/grpc-go.git
client: improve GOAWAY debug messages (#4587)
This commit is contained in:
parent
b586e92158
commit
0103ea2d6c
|
|
@ -1235,7 +1235,11 @@ func (t *http2Client) setGoAwayReason(f *http2.GoAwayFrame) {
|
||||||
t.goAwayReason = GoAwayTooManyPings
|
t.goAwayReason = GoAwayTooManyPings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.goAwayDebugMessage = fmt.Sprintf("code: %s, debug data: %v", f.ErrCode, string(f.DebugData()))
|
if len(f.DebugData()) == 0 {
|
||||||
|
t.goAwayDebugMessage = fmt.Sprintf("code: %s", f.ErrCode)
|
||||||
|
} else {
|
||||||
|
t.goAwayDebugMessage = fmt.Sprintf("code: %s, debug data: %q", f.ErrCode, string(f.DebugData()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *http2Client) GetGoAwayReason() (GoAwayReason, string) {
|
func (t *http2Client) GetGoAwayReason() (GoAwayReason, string) {
|
||||||
|
|
|
||||||
|
|
@ -1453,7 +1453,7 @@ func (s) TestDetailedGoawayErrorOnAbruptClosePropagatesToRPCError(t *testing.T)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%v.FullDuplexCall = _, %v, want _, <nil>", ss.Client, err)
|
t.Fatalf("%v.FullDuplexCall = _, %v, want _, <nil>", ss.Client, err)
|
||||||
}
|
}
|
||||||
const expectedErrorMessageSubstring = "received prior goaway: code: ENHANCE_YOUR_CALM, debug data: too_many_pings"
|
const expectedErrorMessageSubstring = `received prior goaway: code: ENHANCE_YOUR_CALM, debug data: "too_many_pings"`
|
||||||
_, err = stream.Recv()
|
_, err = stream.Recv()
|
||||||
close(rpcDoneOnClient)
|
close(rpcDoneOnClient)
|
||||||
if err == nil || !strings.Contains(err.Error(), expectedErrorMessageSubstring) {
|
if err == nil || !strings.Contains(err.Error(), expectedErrorMessageSubstring) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue