Skip to content

Commit

Permalink
swarm: mark dialing WebTransport addresses as expensive (#1650)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Jul 9, 2022
1 parent 81f973f commit 3d351e4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions p2p/net/swarm/swarm_dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,10 @@ func isFdConsumingAddr(addr ma.Multiaddr) bool {
}

func isExpensiveAddr(addr ma.Multiaddr) bool {
_, err1 := addr.ValueForProtocol(ma.P_WS)
_, err2 := addr.ValueForProtocol(ma.P_WSS)
return err1 == nil || err2 == nil
_, wsErr := addr.ValueForProtocol(ma.P_WS)
_, wssErr := addr.ValueForProtocol(ma.P_WSS)
_, wtErr := addr.ValueForProtocol(ma.P_WEBTRANSPORT)
return wsErr == nil || wssErr == nil || wtErr == nil
}

func isRelayAddr(addr ma.Multiaddr) bool {
Expand Down

0 comments on commit 3d351e4

Please sign in to comment.