Merge pull request #1949 from slingamn/generic_config.2

genericize atomic config changes
This commit is contained in:
Shivaram Lingamneni 2022-05-04 01:30:52 -04:00 committed by GitHub
commit d5814c10ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 9 deletions

View file

@ -7,7 +7,6 @@ import (
"net"
"sync/atomic"
"time"
"unsafe"
"github.com/ergochat/ergo/irc/caps"
"github.com/ergochat/ergo/irc/languages"
@ -16,11 +15,7 @@ import (
)
func (server *Server) Config() (config *Config) {
return (*Config)(atomic.LoadPointer(&server.config))
}
func (server *Server) SetConfig(config *Config) {
atomic.StorePointer(&server.config, unsafe.Pointer(config))
return server.config.Get()
}
func (server *Server) ChannelRegistrationEnabled() bool {