client: update defaults and comments

This commit is contained in:
Aleksandr Razumov
2018-08-13 09:26:36 +03:00
parent 62009d9908
commit 0598f8e141

View File

@@ -37,10 +37,10 @@ type ClientOptions struct {
// agent implementation in current package, see agent.go. // agent implementation in current package, see agent.go.
Agent ClientAgent Agent ClientAgent
// RTO as defined in STUN RFC. // RTO as defined in STUN RFC.
RTO time.Duration // defaults to 500ms RTO time.Duration // defaults to 100ms
// TimeoutRate is rate passed to Collector, the minimum duration between // TimeoutRate is rate passed to Collector, the minimum duration between
// two calls of collector function. // two calls of collector function (efficient minimum RTO timer resolution).
TimeoutRate time.Duration // defaults to 100ms TimeoutRate time.Duration // defaults to 5ms
// Collector is optional implementation of ticker which calls function on each tick. // Collector is optional implementation of ticker which calls function on each tick.
Collector Collector // defaults to ticker collector Collector Collector // defaults to ticker collector
// Clock is optional source of current time. // Clock is optional source of current time.
@@ -57,8 +57,8 @@ var ErrNoConnection = errors.New("no connection provided")
// resources. // resources.
func NewClient(options ClientOptions) (*Client, error) { func NewClient(options ClientOptions) (*Client, error) {
const ( const (
defaultTimeoutRate = time.Millisecond * 100 defaultTimeoutRate = time.Millisecond * 5
defaultRTO = defaultTimeoutRate * 5 defaultRTO = time.Millisecond * 300
) )
c := &Client{ c := &Client{
close: make(chan struct{}), close: make(chan struct{}),