Browse Source

store maxSendQBytes in a uint32 to avoid alignment problems

The sync.atomic documentation says:

"On both ARM and x86-32, it is the caller's responsibility to arrange
for 64-bit alignment of 64-bit words accessed atomically."
tags/v0.11.0-beta
Shivaram Lingamneni 6 years ago
parent
commit
a8b952da77
2 changed files with 3 additions and 3 deletions
  1. 2
    2
      irc/getters.go
  2. 1
    1
      irc/server.go

+ 2
- 2
irc/getters.go View File

@@ -10,11 +10,11 @@ import (
10 10
 )
11 11
 
12 12
 func (server *Server) MaxSendQBytes() int {
13
-	return int(atomic.LoadUint64(&server.maxSendQBytes))
13
+	return int(atomic.LoadUint32(&server.maxSendQBytes))
14 14
 }
15 15
 
16 16
 func (server *Server) SetMaxSendQBytes(m int) {
17
-	atomic.StoreUint64(&server.maxSendQBytes, uint64(m))
17
+	atomic.StoreUint32(&server.maxSendQBytes, uint32(m))
18 18
 }
19 19
 
20 20
 func (server *Server) ISupport() *isupport.List {

+ 1
- 1
irc/server.go View File

@@ -109,7 +109,7 @@ type Server struct {
109 109
 	limits                     Limits
110 110
 	listeners                  map[string]*ListenerWrapper
111 111
 	logger                     *logger.Manager
112
-	maxSendQBytes              uint64
112
+	maxSendQBytes              uint32
113 113
 	monitorManager             *MonitorManager
114 114
 	motdLines                  []string
115 115
 	name                       string

Loading…
Cancel
Save