diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-04 11:04:45 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-08-04 11:04:45 +0900 |
commit | 9914904631b942af6863eb4db1064549aa8e32fe (patch) | |
tree | 7a515a50834c325e42a316e28729112f6a127117 | |
parent | cf23ecec82526d33a67cb101c4384839fea2f95f (diff) |
server: fix 'accepted' number in peer
TODO: we calculate the number every time a CLI request comes. we
should store the number somewhere.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/peer.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go index 11c71221..66b4c3a8 100644 --- a/server/peer.go +++ b/server/peer.go @@ -272,7 +272,14 @@ func (peer *Peer) ToApiStruct() *api.Peer { for _, rf := range peer.configuredRFlist() { advertized += uint32(peer.adjRib.GetOutCount(rf)) received += uint32(peer.adjRib.GetInCount(rf)) - accepted += uint32(peer.adjRib.GetInCount(rf)) + // FIXME: we should store 'accepted' in memory + for _, p := range peer.adjRib.GetInPathList(rf) { + applied, path := peer.applyDistributePolicies(p) + if applied && path == nil || !applied && peer.defaultDistributePolicy != config.DEFAULT_POLICY_TYPE_ACCEPT_ROUTE { + continue + } + accepted += 1 + } } } |