Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Oct 19, 2023
1 parent a92d4e7 commit 1c0aee3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions p2p/net/swarm/dial_ranker.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ func getAddrDelay(addrs []ma.Multiaddr, tcpDelay time.Duration, quicDelay time.D
if isQUICAddr(addrs[0]) && isProtocolAddr(addrs[0], ma.P_IP6) {
for j := 1; j < len(addrs); j++ {
if isQUICAddr(addrs[j]) && isProtocolAddr(addrs[j], ma.P_IP4) {
// The first IPv4 address is at position i
// Move the ith element at position 1 shifting the affected elements
// The first IPv4 address is at position j
// Move the jth element at position 1 shifting the affected elements
if j > 1 {
a := addrs[j]
copy(addrs[2:], addrs[1:j])
Expand Down Expand Up @@ -163,7 +163,7 @@ func getAddrDelay(addrs []ma.Multiaddr, tcpDelay time.Duration, quicDelay time.D
switch {
case isQUICAddr(addr):
// We dial an IPv6 address, then after quicDelay an IPv4
// address, then after a further quicDelay we dial rest of the addresses.
// address, then after a further quicDelay we dial the rest of the addresses.
if i == 1 {
delay = quicDelay
}
Expand All @@ -179,7 +179,7 @@ func getAddrDelay(addrs []ma.Multiaddr, tcpDelay time.Duration, quicDelay time.D
tcpFirstDialDelay = delay + tcpDelay
case isProtocolAddr(addr, ma.P_TCP):
// We dial an IPv6 address, then after tcpDelay an IPv4
// address, then after a further tcpDelay we dial rest of the addresses.
// address, then after a further tcpDelay we dial the rest of the addresses.
if i == tcpStartIdx+1 {
delay = tcpDelay
}
Expand Down

0 comments on commit 1c0aee3

Please sign in to comment.