Skip to content
Snippets Groups Projects
Commit 2677986f authored by Daniel Czerwonk's avatar Daniel Czerwonk
Browse files

simplified loop

parent 57400bcf
No related branches found
No related tags found
No related merge requests found
...@@ -90,7 +90,7 @@ func (u *UpdateSender) sender(aggrTime time.Duration) { ...@@ -90,7 +90,7 @@ func (u *UpdateSender) sender(aggrTime time.Duration) {
for key, pathNLRIs := range u.toSend { for key, pathNLRIs := range u.toSend {
budget = packet.MaxLen - packet.HeaderLen - packet.MinUpdateLen - int(pathNLRIs.path.BGPPath.Length()) - overhead budget = packet.MaxLen - packet.HeaderLen - packet.MinUpdateLen - int(pathNLRIs.path.BGPPath.Length()) - overhead
pathAttrs, err = packet.PathAttributes(pathNLRIs.path, u.iBGP, u.rrClient) pathAttrs, err = packet.PathAttributes(pathNLRIs.path, u.iBGP, u.rrClient)
if err != nil { if err != nil {
log.Errorf("Unable to get path attributes: %v", err) log.Errorf("Unable to get path attributes: %v", err)
...@@ -193,10 +193,8 @@ func (u *UpdateSender) bgpUpdateMultiProtocol(pfxs []bnet.Prefix, pa *packet.Pat ...@@ -193,10 +193,8 @@ func (u *UpdateSender) bgpUpdateMultiProtocol(pfxs []bnet.Prefix, pa *packet.Pat
} }
func (u *UpdateSender) copyAttributesWithoutNextHop(pa *packet.PathAttribute) (attrs *packet.PathAttribute, nextHop bnet.IP) { func (u *UpdateSender) copyAttributesWithoutNextHop(pa *packet.PathAttribute) (attrs *packet.PathAttribute, nextHop bnet.IP) {
cur := pa
var curCopy, lastCopy *packet.PathAttribute var curCopy, lastCopy *packet.PathAttribute
for cur != nil { for cur := pa; cur != nil; cur = cur.Next {
if cur.TypeCode == packet.NextHopAttr { if cur.TypeCode == packet.NextHopAttr {
nextHop = cur.Value.(bnet.IP) nextHop = cur.Value.(bnet.IP)
} else { } else {
...@@ -209,8 +207,6 @@ func (u *UpdateSender) copyAttributesWithoutNextHop(pa *packet.PathAttribute) (a ...@@ -209,8 +207,6 @@ func (u *UpdateSender) copyAttributesWithoutNextHop(pa *packet.PathAttribute) (a
} }
lastCopy = curCopy lastCopy = curCopy
} }
cur = cur.Next
} }
return attrs, nextHop return attrs, nextHop
......
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