Browse Source

fix tag increment

pull/1188/head
vyzo 3 years ago
parent
commit
369df59523
  1. 2
      p2p/protocol/circuitv1/relay/relay.go
  2. 2
      p2p/protocol/circuitv2/relay/relay.go

2
p2p/protocol/circuitv1/relay/relay.go

@ -282,7 +282,7 @@ func (r *Relay) rmConn(p peer.ID) {
} else {
delete(r.conns, p)
}
if conns < MaxRelayHopTag {
if conns <= MaxRelayHopTag {
r.host.ConnManager().UpsertTag(p, RelayHopTag, func(v int) int { return v - 1 })
}

2
p2p/protocol/circuitv2/relay/relay.go

@ -346,7 +346,7 @@ func (r *Relay) addConn(p peer.ID) {
conns := r.conns[p]
conns++
r.conns[p] = conns
if conns < MaxRelayHopTag {
if conns <= MaxRelayHopTag {
r.host.ConnManager().UpsertTag(p, RelayHopTag, func(v int) int { return v + 1 })
}
}

Loading…
Cancel
Save