-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding TCP keepalives support for the broker's connection #408
Changes from 2 commits
76aa551
3a63002
a816b42
4fb06d6
8c2e14c
449c713
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ type Config struct { | |
DialTimeout time.Duration // How long to wait for the initial connection to succeed before timing out and returning an error (default 30s). | ||
ReadTimeout time.Duration // How long to wait for a response before timing out and returning an error (default 30s). | ||
WriteTimeout time.Duration // How long to wait for a transmit to succeed before timing out and returning an error (default 30s). | ||
|
||
// KeepAlive specifies the keep-alive period for an active network connection. | ||
// If zero, keep-alives are not enabled. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "not enabled" == "disabled" Also, please mention that the default is 0 (disabled). |
||
KeepAlive time.Duration | ||
} | ||
|
||
// Metadata is the namespace for metadata management properties used by the Client, and shared by the Producer/Consumer. | ||
|
@@ -126,6 +130,7 @@ func NewConfig() *Config { | |
c.Net.DialTimeout = 30 * time.Second | ||
c.Net.ReadTimeout = 30 * time.Second | ||
c.Net.WriteTimeout = 30 * time.Second | ||
c.Net.KeepAlive = 0 * time.Second | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 0 is the default value for uninitialized struct members, so this line is unnecessary |
||
|
||
c.Metadata.Retry.Max = 3 | ||
c.Metadata.Retry.Backoff = 250 * time.Millisecond | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether this is a useful addition given that we don't actually test it.