3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-25 21:39:25 +01:00

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."
This commit is contained in:
Shivaram Lingamneni 2018-03-19 00:24:20 -04:00
parent d1f5c59eef
commit a8b952da77
2 changed files with 3 additions and 3 deletions

View File

@ -10,11 +10,11 @@ import (
) )
func (server *Server) MaxSendQBytes() int { func (server *Server) MaxSendQBytes() int {
return int(atomic.LoadUint64(&server.maxSendQBytes)) return int(atomic.LoadUint32(&server.maxSendQBytes))
} }
func (server *Server) SetMaxSendQBytes(m int) { func (server *Server) SetMaxSendQBytes(m int) {
atomic.StoreUint64(&server.maxSendQBytes, uint64(m)) atomic.StoreUint32(&server.maxSendQBytes, uint32(m))
} }
func (server *Server) ISupport() *isupport.List { func (server *Server) ISupport() *isupport.List {

View File

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