diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-07-26 14:21:22 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-10-03 23:04:20 +0900 |
commit | bfc6d1b2f9d2bf2add5f4242993be115b752c465 (patch) | |
tree | f5c20e3848115be7410ea7886f43d784128d2439 | |
parent | 2e214c9618fdd7de391ecfd693d3173384a9ac5f (diff) |
server/mrt: Rename a variable to avoid name collision
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>
-rw-r--r-- | server/mrt.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/server/mrt.go b/server/mrt.go index f41bfcce..731c39d6 100644 --- a/server/mrt.go +++ b/server/mrt.go @@ -86,18 +86,18 @@ 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 { @@ -105,23 +105,23 @@ func (m *mrtWriter) loop() error { } 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 { @@ -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() { |