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])
|
caps := strings.Fields(args[0])
|
||||||
ack := true
|
ack := true
|
||||||
|
m := make(map[string]bool, len(caps))
|
||||||
for _, name := range caps {
|
for _, name := range caps {
|
||||||
name = strings.ToLower(name)
|
name = strings.ToLower(name)
|
||||||
enable := !strings.HasPrefix(name, "-")
|
enable := !strings.HasPrefix(name, "-")
|
||||||
@ -900,8 +900,15 @@ func (dc *downstreamConn) handleCapCommand(cmd string, args []string) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m[name] = enable
|
||||||
|
}
|
||||||
|
|
||||||
|
// Atomically ack the whole capability set
|
||||||
|
if ack {
|
||||||
|
for name, enable := range m {
|
||||||
dc.caps.SetEnabled(name, enable)
|
dc.caps.SetEnabled(name, enable)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reply := "NAK"
|
reply := "NAK"
|
||||||
if ack {
|
if ack {
|
||||||
|
Loading…
Reference in New Issue
Block a user