some tweaks
- select 25 of 50 relays instead of 20 - increase connect timeout to 30s
This commit is contained in:
parent
f9e182f747
commit
4629431a12
|
@ -162,7 +162,7 @@ again:
|
||||||
|
|
||||||
log.Debugf("discovered %d relays", len(pis))
|
log.Debugf("discovered %d relays", len(pis))
|
||||||
|
|
||||||
pis = ar.selectRelays(ctx, pis, 20, 50)
|
pis = ar.selectRelays(ctx, pis, 25, 50)
|
||||||
update := 0
|
update := 0
|
||||||
|
|
||||||
for _, pi := range pis {
|
for _, pi := range pis {
|
||||||
|
@ -173,7 +173,7 @@ again:
|
||||||
}
|
}
|
||||||
ar.mx.Unlock()
|
ar.mx.Unlock()
|
||||||
|
|
||||||
cctx, cancel := context.WithTimeout(ctx, 15*time.Second)
|
cctx, cancel := context.WithTimeout(ctx, 30*time.Second)
|
||||||
err = ar.host.Connect(cctx, pi)
|
err = ar.host.Connect(cctx, pi)
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -254,6 +254,8 @@ func (ar *AutoRelay) selectRelays(ctx context.Context, pis []pstore.PeerInfo, co
|
||||||
resultCh <- queryResult{pi: pstore.PeerInfo{ID: pi.ID, Addrs: addrs}, err: nil}
|
resultCh <- queryResult{pi: pstore.PeerInfo{ID: pi.ID, Addrs: addrs}, err: nil}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no known addrs, do a query
|
||||||
go func(p peer.ID) {
|
go func(p peer.ID) {
|
||||||
pi, err := ar.router.FindPeer(qctx, p)
|
pi, err := ar.router.FindPeer(qctx, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue