Skip to content

Commit

Permalink
fix: prioritize QUIC for bootnode connection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Nov 6, 2023
1 parent 61cf543 commit d6cb66e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/topology/kademlia/kademlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"math/big"
"math/rand"
"path/filepath"
"sort"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -135,6 +137,11 @@ func newKadOptions(o Options) kadOptions {
LowWaterMark: defaultValInt(o.LowWaterMark, defaultLowWaterMark),
}

// Prioritize QUIC transport connections over the others.
sort.Slice(ko.Bootnodes, func(i, j int) bool {
return strings.Contains(ko.Bootnodes[i].String(), "/quic")
})

if ko.SaturationFunc == nil {
ko.SaturationFunc = makeSaturationFunc(ko)
}
Expand Down

0 comments on commit d6cb66e

Please sign in to comment.