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

Method retryLocked

stream.go:783–804  ·  view source on GitHub ↗

Returns nil if a retry was performed and succeeded; error otherwise.

(attempt *csAttempt, lastErr error)

Source from the content-addressed store, hash-verified

781
782// Returns nil if a retry was performed and succeeded; error otherwise.
783func (cs *clientStream) retryLocked(attempt *csAttempt, lastErr error) error {
784 for {
785 attempt.finish(toRPCErr(lastErr))
786 isTransparent, err := attempt.shouldRetry(lastErr)
787 if err != nil {
788 cs.commitAttemptLocked()
789 return err
790 }
791 cs.firstAttempt = false
792 attempt, err = cs.newAttemptLocked(isTransparent)
793 if err != nil {
794 // Only returns error if the clientconn is closed or the context of
795 // the stream is canceled.
796 return err
797 }
798 // Note that the first op in replayBuffer always sets cs.attempt
799 // if it is able to pick a transport and create a stream.
800 if lastErr = cs.replayBufferLocked(attempt); lastErr == nil {
801 return nil
802 }
803 }
804}
805
806func (cs *clientStream) Context() context.Context {
807 cs.commitAttempt()

Callers 1

withRetryMethod · 0.95

Calls 6

commitAttemptLockedMethod · 0.95
newAttemptLockedMethod · 0.95
replayBufferLockedMethod · 0.95
toRPCErrFunction · 0.85
shouldRetryMethod · 0.80
finishMethod · 0.45

Tested by

no test coverage detected