mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-11 06:39:08 -07:00
Introduce PeerKey
PeerKeys are used to prevent overwriting of peers which want to announce for both IPv4 and IPv6.
This commit is contained in:
@@ -139,11 +139,12 @@ func (s *Stats) RecordEvent(event int) {
|
||||
s.events <- event
|
||||
}
|
||||
|
||||
func (s *Stats) RecordPeerEvent(event int, ipv6 bool) {
|
||||
if ipv6 {
|
||||
s.ipv6PeerEvents <- event
|
||||
} else {
|
||||
func (s *Stats) RecordPeerEvent(event int, ipv string) {
|
||||
switch ipv {
|
||||
case "ipv4":
|
||||
s.ipv4PeerEvents <- event
|
||||
case "ipv6":
|
||||
s.ipv6PeerEvents <- event
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,8 +266,8 @@ func RecordEvent(event int) {
|
||||
}
|
||||
|
||||
// RecordPeerEvent broadcasts a peer event to the default stats queue.
|
||||
func RecordPeerEvent(event int, ipv6 bool) {
|
||||
DefaultStats.RecordPeerEvent(event, ipv6)
|
||||
func RecordPeerEvent(event int, ipv string) {
|
||||
DefaultStats.RecordPeerEvent(event, ipv)
|
||||
}
|
||||
|
||||
// RecordTiming broadcasts a timing event to the default stats queue.
|
||||
|
||||
Reference in New Issue
Block a user