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

Method shutdownRemainingLocked

balancer/pickfirst/pickfirst.go:521–530  ·  view source on GitHub ↗

shutdownRemainingLocked shuts down remaining subConns. Called when a subConn becomes ready, which means that all other subConn must be shutdown.

(selected *scData)

Source from the content-addressed store, hash-verified

519// shutdownRemainingLocked shuts down remaining subConns. Called when a subConn
520// becomes ready, which means that all other subConn must be shutdown.
521func (b *pickfirstBalancer) shutdownRemainingLocked(selected *scData) {
522 b.cancelConnectionTimer()
523 for _, sd := range b.subConns.All() {
524 if sd.subConn != selected.subConn {
525 sd.subConn.Shutdown()
526 }
527 }
528 b.subConns = resolver.NewAddressMapV2[*scData]()
529 b.subConns.Set(selected.addr, selected)
530}
531
532// requestConnectionLocked starts connecting on the subchannel corresponding to
533// the current address. If no subchannel exists, one is created. If the current

Callers 1

updateSubConnStateMethod · 0.95

Calls 3

ShutdownMethod · 0.65
SetMethod · 0.65
AllMethod · 0.45

Tested by

no test coverage detected