Skip to content

Commit 9399bb1

Browse files
committed
revert local copy in updateLocalityID
1 parent 1588fd2 commit 9399bb1

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

xds/internal/balancer/clusterimpl/clusterimpl.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,7 @@ type scWrapper struct {
418418
}
419419

420420
func (scw *scWrapper) updateLocalityID(lID clients.Locality) {
421-
// Store a pointer to a new, heap-allocated clients.Locality because the
422-
// pointer (scw.locality) is stored in an atomic.Pointer, and must remain
423-
// valid for concurrent access by other goroutines even after this function
424-
// returns.
425-
l := new(clients.Locality)
426-
*l = lID
427-
scw.locality.Store(l)
421+
scw.locality.Store(&lID)
428422
}
429423

430424
func (scw *scWrapper) localityID() clients.Locality {

xds/internal/clients/grpctransport/grpc_transport_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func (s) TestNewStream_Error(t *testing.T) {
359359
// request on the server is same as sent. It then wait to receive a
360360
// testDiscoverResponse from the server and verifies that the received
361361
// discovery response is same as sent from the server.
362-
func (s) TestStream_SendAndRecv(t *testing.T) {
362+
func TestStream_SendAndRecv(t *testing.T) {
363363
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
364364
defer cancel()
365365

0 commit comments

Comments
 (0)