mirror of
https://github.com/status-im/status-go.git
synced 2025-01-23 13:11:11 +00:00
eeca435064
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
30 lines
886 B
Go
30 lines
886 B
Go
package net
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// DialPeerTimeout is the default timeout for a single call to `DialPeer`. When
|
|
// there are multiple concurrent calls to `DialPeer`, this timeout will apply to
|
|
// each independently.
|
|
var DialPeerTimeout = 60 * time.Second
|
|
|
|
type dialPeerTimeoutCtxKey struct{}
|
|
|
|
// GetDialPeerTimeout returns the current DialPeer timeout (or the default).
|
|
func GetDialPeerTimeout(ctx context.Context) time.Duration {
|
|
if to, ok := ctx.Value(dialPeerTimeoutCtxKey{}).(time.Duration); ok {
|
|
return to
|
|
}
|
|
return DialPeerTimeout
|
|
}
|
|
|
|
// WithDialPeerTimeout returns a new context with the DialPeer timeout applied.
|
|
//
|
|
// This timeout overrides the default DialPeerTimeout and applies per-dial
|
|
// independently.
|
|
func WithDialPeerTimeout(ctx context.Context, timeout time.Duration) context.Context {
|
|
return context.WithValue(ctx, dialPeerTimeoutCtxKey{}, timeout)
|
|
}
|