summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2022-06-04 04:02:07 -0400
committerWill Hawkins <[email protected]>2022-06-04 04:02:07 -0400
commitd38bea818a90a0ca2bfc17e96c00b9896e2c61ca (patch)
tree7685d2d305276dc15e7a7ede9d244b78d9362c31
parenteb8f1e7826c375b1ad8ea16e842451677d74df11 (diff)
[Bugfix #21] Bad alignment of elements in structs accessed atomically
Fixes #21
-rw-r--r--lgc/lgc.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/lgc/lgc.go b/lgc/lgc.go
index 59b623d..13f2c06 100644
--- a/lgc/lgc.go
+++ b/lgc/lgc.go
@@ -40,12 +40,14 @@ type LoadGeneratingConnection interface {
ClientId() uint64
}
+// TODO: All 64-bit fields that are accessed atomically must
+// appear at the top of this struct.
type LoadGeneratingConnectionDownload struct {
- Path string
downloaded uint64
+ lastIntervalEnd int64
+ Path string
downloadStartTime time.Time
lastDownloaded uint64
- lastIntervalEnd int64
client *http.Client
debug debug.DebugLevel
valid bool
@@ -312,12 +314,14 @@ func (lbd *LoadGeneratingConnectionDownload) doDownload(ctx context.Context) {
}
}
+// TODO: All 64-bit fields that are accessed atomically must
+// appear at the top of this struct.
type LoadGeneratingConnectionUpload struct {
- Path string
uploaded uint64
+ lastIntervalEnd int64
+ Path string
uploadStartTime time.Time
lastUploaded uint64
- lastIntervalEnd int64
client *http.Client
debug debug.DebugLevel
valid bool