mirror of
https://github.com/ergochat/ergo.git
synced 2025-01-22 02:04:10 +01:00
parent
de31430fdc
commit
4e49a25ba6
@ -153,10 +153,8 @@ func (server *Server) Run() {
|
|||||||
return
|
return
|
||||||
|
|
||||||
case <-server.rehashSignal:
|
case <-server.rehashSignal:
|
||||||
go func() {
|
server.logger.Info("server", "Rehashing due to SIGHUP")
|
||||||
server.logger.Info("server", "Rehashing due to SIGHUP")
|
go server.rehash()
|
||||||
server.rehash()
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,14 +518,24 @@ func (client *Client) getWhoisOf(target *Client, hasPrivs bool, rb *ResponseBuff
|
|||||||
|
|
||||||
// rehash reloads the config and applies the changes from the config file.
|
// rehash reloads the config and applies the changes from the config file.
|
||||||
func (server *Server) rehash() error {
|
func (server *Server) rehash() error {
|
||||||
|
// #1570; this needs its own panic handling because it can be invoked via SIGHUP
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
if server.Config().Debug.recoverFromErrors {
|
||||||
|
server.logger.Error("internal",
|
||||||
|
fmt.Sprintf("Panic during rehash: %v\n%s", r, debug.Stack()))
|
||||||
|
} else {
|
||||||
|
panic(r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
server.logger.Info("server", "Attempting rehash")
|
server.logger.Info("server", "Attempting rehash")
|
||||||
|
|
||||||
// only let one REHASH go on at a time
|
// only let one REHASH go on at a time
|
||||||
server.rehashMutex.Lock()
|
server.rehashMutex.Lock()
|
||||||
defer server.rehashMutex.Unlock()
|
defer server.rehashMutex.Unlock()
|
||||||
|
|
||||||
server.logger.Debug("server", "Got rehash lock")
|
|
||||||
|
|
||||||
config, err := LoadConfig(server.configFilename)
|
config, err := LoadConfig(server.configFilename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
server.logger.Error("server", "failed to load config file", err.Error())
|
server.logger.Error("server", "failed to load config file", err.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user