1
0
Fork 0
forked from External/grumble

Use a RWMutex for server config locking instead of routing config gets and sets through Server#handler.

This commit is contained in:
Mikkel Krautz 2011-05-13 15:32:42 +02:00
parent 41f6af2334
commit c785c45166
5 changed files with 62 additions and 61 deletions

View file

@ -30,7 +30,7 @@ type ConfigValue struct {
// Set a config value
func (c *ControlRPC) SetConfig(in *ConfigValue, out *ConfigValue) os.Error {
servers[in.Id].SetConfig(in.Key, in.Value)
servers[in.Id].cfg.Set(in.Key, in.Value)
out.Id = in.Id
out.Key = in.Key
out.Value = in.Value
@ -41,6 +41,6 @@ func (c *ControlRPC) SetConfig(in *ConfigValue, out *ConfigValue) os.Error {
func (c *ControlRPC) GetConfig(in *ConfigValue, out *ConfigValue) os.Error {
out.Id = in.Id
out.Key = in.Key
out.Value = servers[in.Id].GetConfig(in.Key)
out.Value = servers[in.Id].cfg.StringValue(in.Key)
return nil
}