Browse Source

Fuse with if above

pull/1677/head
Marco Munizaga 2 years ago
parent
commit
63bb42e10d
  1. 22
      p2p/host/resource-manager/rcmgr.go

22
p2p/host/resource-manager/rcmgr.go

@ -590,18 +590,18 @@ func (s *connectionScope) SetPeer(p peer.ID) error {
if s.isAllowlisted {
system = s.rcmgr.allowlistedSystem
transient = s.rcmgr.transient
}
if s.isAllowlisted && !s.rcmgr.allowlist.AllowedPeerAndMultiaddr(p, s.endpoint) {
// This is not an allowed peer + multiaddr combination. We need to
// transfer this connection to the general scope. We'll do this first by
// transferring the connection to the system and transient scopes, then
// continue on with this function. The idea is that a connection
// shouldn't get the benefit of evading the transient scope because it
// was _almost_ an allowlisted connection.
if err := s.transferAllowedToStandard(); err != nil {
// Failed to transfer this connection to the standard scopes
return err
if !s.rcmgr.allowlist.AllowedPeerAndMultiaddr(p, s.endpoint) {
// This is not an allowed peer + multiaddr combination. We need to
// transfer this connection to the general scope. We'll do this first by
// transferring the connection to the system and transient scopes, then
// continue on with this function. The idea is that a connection
// shouldn't get the benefit of evading the transient scope because it
// was _almost_ an allowlisted connection.
if err := s.transferAllowedToStandard(); err != nil {
// Failed to transfer this connection to the standard scopes
return err
}
}
}

Loading…
Cancel
Save