Skip to content

Commit

Permalink
grpc: add a comment explaining why updateClientConnState is handled i…
Browse files Browse the repository at this point in the history
…nline (#5261)
  • Loading branch information
easwars committed Mar 21, 2022
1 parent 7ea4af9 commit 7840bd6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions balancer_conn_wrappers.go
Expand Up @@ -167,6 +167,15 @@ func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s co
})
}

// updateClientConnState forwards the clientConn update to the wrapped balancer
// synchronously.
//
// Other calls from the channel like exitIdle() and handleSubConnStateChange()
// are handled asynchronously by pushing the update onto a channel, which is
// picked up by the watcher() goroutine and forwarded to the wrapped balancer.
// That approach cannot be taken here because the corresponding API on the
// balancer returns an error which needs to be sent back to the channel to be
// forward to the resolver.
func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error {
ccb.balancerMu.Lock()
defer ccb.balancerMu.Unlock()
Expand Down

0 comments on commit 7840bd6

Please sign in to comment.