network/transport: fix default dial timeout

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-11-06 11:18:12 +03:00
parent 72bbbe3817
commit be8d09c663
2 changed files with 3 additions and 5 deletions

View File

@ -64,6 +64,7 @@ type DialOptions struct {
// NewDialOptions returns new DialOptions // NewDialOptions returns new DialOptions
func NewDialOptions(opts ...DialOption) DialOptions { func NewDialOptions(opts ...DialOption) DialOptions {
options := DialOptions{ options := DialOptions{
Timeout: DefaultDialTimeout,
Context: context.Background(), Context: context.Background(),
} }

View File

@ -9,6 +9,8 @@ import (
var ( var (
// DefaultTransport is the global default transport // DefaultTransport is the global default transport
DefaultTransport Transport = NewTransport() DefaultTransport Transport = NewTransport()
// Default dial timeout
DefaultDialTimeout = time.Second * 5
) )
// Transport is an interface which is used for communication between // Transport is an interface which is used for communication between
@ -57,8 +59,3 @@ type DialOption func(*DialOptions)
// ListenOption is the option signature // ListenOption is the option signature
type ListenOption func(*ListenOptions) type ListenOption func(*ListenOptions)
var (
// Default dial timeout
DefaultDialTimeout = time.Second * 5
)