make 64bit atomics also align on 32bit (#2386)

do this by simply putting them at the front of each struct
see https://pkg.go.dev/sync/atomic#pkg-note-BUG

fixes #2383

Co-authored-by: akarl10 <mike@mwys.mine.bz>
This commit is contained in:
akarl10
2024-02-17 11:44:55 -08:00
committed by GitHub
co-authored by akarl10
parent 110cc83508
commit 7658e1b60d
3 changed files with 17 additions and 7 deletions
+4 -1
View File
@@ -37,6 +37,10 @@ type UpTrackManagerParams struct {
// UpTrackManager manages all uptracks from a participant
type UpTrackManager struct {
// utils.TimedVersion is a atomic. To be correctly aligned also on 32bit archs
// 64it atomics need to be at the front of a struct
subscriptionPermissionVersion utils.TimedVersion
params UpTrackManagerParams
closed bool
@@ -44,7 +48,6 @@ type UpTrackManager struct {
// publishedTracks that participant is publishing
publishedTracks map[livekit.TrackID]types.MediaTrack
subscriptionPermission *livekit.SubscriptionPermission
subscriptionPermissionVersion utils.TimedVersion
// subscriber permission for published tracks
subscriberPermissions map[livekit.ParticipantIdentity]*livekit.TrackPermission // subscriberIdentity => *livekit.TrackPermission