xds: ensure the active streams counters are 64 bit aligned on 32 bit systems (#11085)

This commit is contained in:
R.B. Boyer 2021-09-20 11:07:11 -05:00 committed by GitHub
parent a727ee6416
commit 55b36dd056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

3
.changelog/11085.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
xds: ensure the active streams counters are 64 bit aligned on 32 bit systems
```

View File

@ -152,11 +152,12 @@ type Server struct {
DisableV2Protocol bool
activeStreams activeStreamCounters
activeStreams *activeStreamCounters
}
// activeStreamCounters simply encapsulates two counters accessed atomically to
// ensure alignment is correct.
// ensure alignment is correct. This further requires that activeStreamCounters
// be a pointer field.
type activeStreamCounters struct {
xDSv3 uint64
xDSv2 uint64
@ -197,6 +198,7 @@ func NewServer(
CheckFetcher: checkFetcher,
CfgFetcher: cfgFetcher,
AuthCheckFrequency: DefaultAuthCheckFrequency,
activeStreams: &activeStreamCounters{},
}
}