Skip to content

Commit

Permalink
fix(link): noroute skip
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jul 12, 2024
1 parent f25df3c commit 4a8e848
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gold/link/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,17 @@ func (m *Me) AddPeer(cfg *PeerConfig) (l *Link) {
}
}
_, cidr, err := net.ParseCIDR(ipnet)
if err == nil {
l.allowedips = append(l.allowedips, cidr)
l.me.router.SetItem(cidr, l)
l.me.connmapmu.Lock()
l.me.connections[cfg.PeerIP] = l
l.me.connmapmu.Unlock()
} else {
if err != nil {
panic(err)
}
l.allowedips = append(l.allowedips, cidr)
if noroute {
continue
}
l.me.router.SetItem(cidr, l)
l.me.connmapmu.Lock()
l.me.connections[cfg.PeerIP] = l
l.me.connmapmu.Unlock()
}
}
logrus.Infoln("[peer] add peer:", cfg.PeerIP, "allow:", cfg.AllowedIPs)
Expand Down

0 comments on commit 4a8e848

Please sign in to comment.