mirror of https://github.com/status-im/consul.git
Update ServiceIntentionSourceIndex to handle peer
This commit is contained in:
parent
bb832e2bba
commit
bb0b42da12
|
@ -101,8 +101,17 @@ func (s *ServiceIntentionSourceIndex) FromObject(obj interface{}) (bool, [][]byt
|
||||||
|
|
||||||
vals := make([][]byte, 0, len(ixnEntry.Sources))
|
vals := make([][]byte, 0, len(ixnEntry.Sources))
|
||||||
for _, src := range ixnEntry.Sources {
|
for _, src := range ixnEntry.Sources {
|
||||||
sn := src.SourceServiceName()
|
peer := src.Peer
|
||||||
vals = append(vals, []byte(sn.String()+"\x00"))
|
if peer == "" {
|
||||||
|
peer = structs.LocalPeerKeyword
|
||||||
|
}
|
||||||
|
sn := src.SourceServiceName().String()
|
||||||
|
|
||||||
|
// add 2 for null separator after each string
|
||||||
|
buf := newIndexBuilder(len(peer) + len(sn) + 2)
|
||||||
|
buf.String(peer)
|
||||||
|
buf.String(sn)
|
||||||
|
vals = append(vals, buf.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(vals) == 0 {
|
if len(vals) == 0 {
|
||||||
|
|
Loading…
Reference in New Issue