MCPcopy
hub / github.com/grpc/grpc-go / doneChannelzWrapper

Function doneChannelzWrapper

picker_wrapper.go:76–90  ·  view source on GitHub ↗

doneChannelzWrapper performs the following: - increments the calls started channelz counter - wraps the done function in the passed in result to increment the calls failed or calls succeeded channelz counter before invoking the actual done function.

(acbw *acBalancerWrapper, result *balancer.PickResult)

Source from the content-addressed store, hash-verified

74// failed or calls succeeded channelz counter before invoking the actual
75// done function.
76func doneChannelzWrapper(acbw *acBalancerWrapper, result *balancer.PickResult) {
77 ac := acbw.ac
78 ac.incrCallsStarted()
79 done := result.Done
80 result.Done = func(b balancer.DoneInfo) {
81 if b.Err != nil && b.Err != io.EOF {
82 ac.incrCallsFailed()
83 } else {
84 ac.incrCallsSucceeded()
85 }
86 if done != nil {
87 done(b)
88 }
89 }
90}
91
92type pick struct {
93 transport transport.ClientTransport // the selected transport

Callers 1

pickMethod · 0.85

Calls 3

incrCallsStartedMethod · 0.45
incrCallsFailedMethod · 0.45
incrCallsSucceededMethod · 0.45

Tested by

no test coverage detected