mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
rehash cannot modify the server name
This commit is contained in:
parent
3b0f1ff1cc
commit
b7b24c34b4
@ -1206,6 +1206,13 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
||||
if initial {
|
||||
server.ctime = time.Now()
|
||||
server.configFilename = config.Filename
|
||||
} else {
|
||||
// enforce configs that can't be changed after launch:
|
||||
if server.limits.LineLen.Tags != config.Limits.LineLen.Tags || server.limits.LineLen.Rest != config.Limits.LineLen.Rest {
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
casefoldedName, err := Casefold(config.Server.Name)
|
||||
@ -1213,13 +1220,6 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
||||
return fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
|
||||
}
|
||||
|
||||
if !initial {
|
||||
// line lengths cannot be changed after launching the server
|
||||
if server.limits.LineLen.Tags != config.Limits.LineLen.Tags || server.limits.LineLen.Rest != config.Limits.LineLen.Rest {
|
||||
return fmt.Errorf("Maximum line length (linelen) cannot be changed after launching the server, rehash aborted")
|
||||
}
|
||||
}
|
||||
|
||||
// confirm connectionLimits are fine
|
||||
connectionLimits, err := NewConnectionLimits(config.Server.ConnectionLimits)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user