1
0
Fork 0
forked from External/ergo

add client compatibility switches

This commit is contained in:
Shivaram Lingamneni 2019-05-09 14:18:30 -04:00
parent 939729a7c0
commit fbc6c84a01
6 changed files with 54 additions and 17 deletions

View file

@ -19,6 +19,7 @@ import (
"sync"
"syscall"
"time"
"unsafe"
"github.com/goshuirc/irc-go/ircfmt"
"github.com/oragono/oragono/irc/caps"
@ -65,7 +66,7 @@ type Server struct {
channels ChannelManager
channelRegistry ChannelRegistry
clients ClientManager
config *Config
config unsafe.Pointer
configFilename string
configurableStateMutex sync.RWMutex // tier 1; generic protection for server state modified by rehash()
connectionLimiter *connection_limits.Limiter
@ -602,7 +603,7 @@ func (server *Server) applyConfig(config *Config, initial bool) (err error) {
return fmt.Errorf("Maximum line length (linelen) cannot be changed after launching the server, rehash aborted")
} else if server.name != config.Server.Name {
return fmt.Errorf("Server name cannot be changed after launching the server, rehash aborted")
} else if server.config.Datastore.Path != config.Datastore.Path {
} else if server.Config().Datastore.Path != config.Datastore.Path {
return fmt.Errorf("Datastore path cannot be changed after launching the server, rehash aborted")
}
}
@ -776,9 +777,7 @@ func (server *Server) applyConfig(config *Config, initial bool) (err error) {
server.loadMOTD(config.Server.MOTD, config.Server.MOTDFormatting)
// save a pointer to the new config
server.configurableStateMutex.Lock()
server.config = config
server.configurableStateMutex.Unlock()
server.SetConfig(config)
server.logger.Info("server", "Using datastore", config.Datastore.Path)
if initial {