Skip to content

Commit

Permalink
server/mrt: Rename a variable to avoid name collision
Browse files Browse the repository at this point in the history
The variable "m" in mrtWriter.loop() collides its receiver "m *mrtWriter".
This patch renames this variable name.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
  • Loading branch information
iwaseyusuke authored and fujita committed Oct 3, 2017
1 parent 2e214c9 commit bfc6d1b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions server/mrt.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,42 +86,42 @@ func (m *mrtWriter) loop() error {
for {
serialize := func(ev WatchEvent) []*mrt.MRTMessage {
msg := make([]*mrt.MRTMessage, 0, 1)
switch m := ev.(type) {
switch e := ev.(type) {
case *WatchEventUpdate:
subtype := mrt.MESSAGE_AS4
mp := mrt.NewBGP4MPMessage(m.PeerAS, m.LocalAS, 0, m.PeerAddress.String(), m.LocalAddress.String(), m.FourBytesAs, nil)
mp.BGPMessagePayload = m.Payload
if m.FourBytesAs == false {
mp := mrt.NewBGP4MPMessage(e.PeerAS, e.LocalAS, 0, e.PeerAddress.String(), e.LocalAddress.String(), e.FourBytesAs, nil)
mp.BGPMessagePayload = e.Payload
if e.FourBytesAs == false {
subtype = mrt.MESSAGE
}
if bm, err := mrt.NewMRTMessage(uint32(m.Timestamp.Unix()), mrt.BGP4MP, subtype, mp); err != nil {
if bm, err := mrt.NewMRTMessage(uint32(e.Timestamp.Unix()), mrt.BGP4MP, subtype, mp); err != nil {
log.WithFields(log.Fields{
"Topic": "mrt",
"Data": m,
"Data": e,
"Error": err,
}).Warn("Failed to create MRT message in serialize()")
} else {
msg = append(msg, bm)
}
case *WatchEventTable:
t := uint32(time.Now().Unix())
peers := make([]*mrt.Peer, 0, len(m.Neighbor))
for _, pconf := range m.Neighbor {
peers := make([]*mrt.Peer, 0, len(e.Neighbor))
for _, pconf := range e.Neighbor {
peers = append(peers, mrt.NewPeer(pconf.State.RemoteRouterId, pconf.State.NeighborAddress, pconf.Config.PeerAs, true))
}
if bm, err := mrt.NewMRTMessage(t, mrt.TABLE_DUMPv2, mrt.PEER_INDEX_TABLE, mrt.NewPeerIndexTable(m.RouterId, "", peers)); err != nil {
if bm, err := mrt.NewMRTMessage(t, mrt.TABLE_DUMPv2, mrt.PEER_INDEX_TABLE, mrt.NewPeerIndexTable(e.RouterId, "", peers)); err != nil {
break
} else {
msg = append(msg, bm)
}

idx := func(p *table.Path) uint16 {
for i, pconf := range m.Neighbor {
for i, pconf := range e.Neighbor {
if p.GetSource().Address.String() == pconf.State.NeighborAddress {
return uint16(i)
}
}
return uint16(len(m.Neighbor))
return uint16(len(e.Neighbor))
}

subtype := func(p *table.Path) mrt.MRTSubTypeTableDumpv2 {
Expand All @@ -139,7 +139,7 @@ func (m *mrtWriter) loop() error {
}

seq := uint32(0)
for _, pathList := range m.PathList {
for _, pathList := range e.PathList {
entries := make([]*mrt.RibEntry, 0, len(pathList))
for _, path := range pathList {
if path.IsLocal() {
Expand Down

0 comments on commit bfc6d1b

Please sign in to comment.