Skip to content
Snippets Groups Projects
Commit c92109a9 authored by Oliver Herms's avatar Oliver Herms
Browse files

Implemented UpdateNewClient

parent 9fd9f79b
No related branches found
No related tags found
No related merge requests found
package adjRIBIn package adjRIBIn
import ( import (
"fmt"
"sync" "sync"
"github.com/bio-routing/bio-rd/net" "github.com/bio-routing/bio-rd/net"
...@@ -27,7 +26,17 @@ func NewAdjRIBIn() *AdjRIBIn { ...@@ -27,7 +26,17 @@ func NewAdjRIBIn() *AdjRIBIn {
// UpdateNewClient sends current state to a new client // UpdateNewClient sends current state to a new client
func (a *AdjRIBIn) UpdateNewClient(client routingtable.RouteTableClient) error { func (a *AdjRIBIn) UpdateNewClient(client routingtable.RouteTableClient) error {
return fmt.Errorf("Not implemented") a.mu.RLock()
defer a.mu.RUnlock()
routes := a.rt.Dump()
for _, route := range routes {
paths := route.Paths()
for _, path := range paths {
client.AddPath(route.Prefix(), path)
}
}
return nil
} }
// AddPath replaces the path for prefix `pfx`. If the prefix doesn't exist it is added. // AddPath replaces the path for prefix `pfx`. If the prefix doesn't exist it is added.
...@@ -37,6 +46,10 @@ func (a *AdjRIBIn) AddPath(pfx net.Prefix, p *route.Path) error { ...@@ -37,6 +46,10 @@ func (a *AdjRIBIn) AddPath(pfx net.Prefix, p *route.Path) error {
oldPaths := a.rt.ReplacePath(pfx, p) oldPaths := a.rt.ReplacePath(pfx, p)
a.removePathsFromClients(pfx, oldPaths) a.removePathsFromClients(pfx, oldPaths)
for _, client := range a.ClientManager.Clients() {
client.AddPath(pfx, p)
}
return nil return nil
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment