downstream: atomically ack/nak capabilities
This commit is contained in:
parent
6e094b1099
commit
35b09f069c
@ -875,9 +875,9 @@ func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
|
||||
}}
|
||||
}
|
||||
|
||||
// TODO: atomically ack/nak the whole capability set
|
||||
caps := strings.Fields(args[0])
|
||||
ack := true
|
||||
m := make(map[string]bool, len(caps))
|
||||
for _, name := range caps {
|
||||
name = strings.ToLower(name)
|
||||
enable := !strings.HasPrefix(name, "-")
|
||||
@ -900,8 +900,15 @@ func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
|
||||
break
|
||||
}
|
||||
|
||||
m[name] = enable
|
||||
}
|
||||
|
||||
// Atomically ack the whole capability set
|
||||
if ack {
|
||||
for name, enable := range m {
|
||||
dc.caps.SetEnabled(name, enable)
|
||||
}
|
||||
}
|
||||
|
||||
reply := "NAK"
|
||||
if ack {
|
||||
|
Loading…
Reference in New Issue
Block a user