Skip to content

Commit 4a8e848

Browse files
committed
fix(link): noroute skip
1 parent f25df3c commit 4a8e848

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

gold/link/peer.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,17 @@ func (m *Me) AddPeer(cfg *PeerConfig) (l *Link) {
9292
}
9393
}
9494
_, cidr, err := net.ParseCIDR(ipnet)
95-
if err == nil {
96-
l.allowedips = append(l.allowedips, cidr)
97-
l.me.router.SetItem(cidr, l)
98-
l.me.connmapmu.Lock()
99-
l.me.connections[cfg.PeerIP] = l
100-
l.me.connmapmu.Unlock()
101-
} else {
95+
if err != nil {
10296
panic(err)
10397
}
98+
l.allowedips = append(l.allowedips, cidr)
99+
if noroute {
100+
continue
101+
}
102+
l.me.router.SetItem(cidr, l)
103+
l.me.connmapmu.Lock()
104+
l.me.connections[cfg.PeerIP] = l
105+
l.me.connmapmu.Unlock()
104106
}
105107
}
106108
logrus.Infoln("[peer] add peer:", cfg.PeerIP, "allow:", cfg.AllowedIPs)

0 commit comments

Comments
 (0)