Skip to content
Snippets Groups Projects
Commit fd1ccf16 authored by pberndro's avatar pberndro
Browse files

remove log for performance reasons and add count function for routes in LocRIB

parent 631f24f8
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ func main() {
go func() {
for {
fmt.Print(rib.Print())
fmt.Printf("LocRIB count: %d\n", rib.Count())
time.Sleep(time.Second * 10)
}
}()
......
......@@ -82,7 +82,6 @@ func serializeAndSendUpdate(out io.Writer, update serializeAbleUpdate) error {
return nil
}
fmt.Printf("Sending Update: %v\n", updateBytes)
_, err = out.Write(updateBytes)
if err != nil {
return fmt.Errorf("Failed sending Update: %v", err)
......
......@@ -72,12 +72,10 @@ func (a *AdjRIBOut) AddPath(pfx bnet.Prefix, p *route.Path) error {
a.removePathsFromClients(pfx, oldPaths)
}
fmt.Printf("Adding path: %s\n", p.Print())
pathID, err := a.pathIDManager.addPath(p)
if err != nil {
return fmt.Errorf("Unable to get path ID: %v", err)
}
fmt.Printf("New path ID: %d\n", pathID)
p.BGPPath.PathIdentifier = pathID
a.rt.AddPath(pfx, p)
......
......@@ -27,6 +27,14 @@ func New() *LocRIB {
return a
}
//Count routes from the LocRIP
func (a *LocRIB) Count() uint64 {
a.mu.RLock()
defer a.mu.RUnlock()
return uint64(len(a.rt.Dump()))
}
// UpdateNewClient sends current state to a new client
func (a *LocRIB) UpdateNewClient(client routingtable.RouteTableClient) error {
a.mu.RLock()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment