summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-04-20 15:31:27 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-04-20 15:31:27 +0900
commit7fc795694637c06be52cad97cf7397db0c7431fb (patch)
tree9b4baa7d88122b2b0370758cf2b4c5aba8de8a6f /server/server.go
parente429c1aaf4dd85459dfafc1a5efac9d4778370f6 (diff)
improve performance of getting single neighbor information
avoid calculation of the number of adjout that will not be used. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/server.go b/server/server.go
index da6feba2..ed245ff8 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1542,10 +1542,13 @@ func (s *BgpServer) GetServer() (c *config.Global) {
return c
}
-func (s *BgpServer) GetNeighbor(getAdvertised bool) (l []*config.Neighbor) {
+func (s *BgpServer) GetNeighbor(address string, getAdvertised bool) (l []*config.Neighbor) {
s.mgmtOperation(func() error {
l = make([]*config.Neighbor, 0, len(s.neighborMap))
- for _, peer := range s.neighborMap {
+ for k, peer := range s.neighborMap {
+ if address != "" && address != k {
+ continue
+ }
l = append(l, peer.ToConfig(getAdvertised))
}
return nil