-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
The comment says that KeepAlive specifies the interval:
Lines 171 to 181 in 396a48b
| // KeepAlive specifies the interval between keep-alive | |
| // probes for an active network connection. | |
| // | |
| // KeepAlive is ignored if KeepAliveConfig.Enable is true. | |
| // | |
| // If zero, keep-alive probes are sent with a default value | |
| // (currently 15 seconds), if supported by the protocol and operating | |
| // system. Network protocols or operating systems that do | |
| // not support keep-alive ignore this field. | |
| // If negative, keep-alive probes are disabled. | |
| KeepAlive time.Duration |
In fact, it is used as the idle time:
Line 289 in 396a48b
| func newTCPConn(fd *netFD, keepAliveIdle time.Duration, keepAliveCfg KeepAliveConfig, preKeepAliveHook func(*netFD), keepAliveHook func(KeepAliveConfig)) *TCPConn { |
The KeepAlive field is passed as the second argument, which means idle instead of the interval. It is equal to the Idle field in the KeepAliveConfig:
type KeepAliveConfig struct {
// If Enable is true, keep-alive probes are enabled.
Enable bool
// Idle is the time that the connection must be idle before
// the first keep-alive probe is sent.
// If zero, a default value of 15 seconds is used.
Idle time.Duration
// Interval is the time between keep-alive probes.
// If zero, a default value of 15 seconds is used.
Interval time.Duration
// Count is the maximum number of keep-alive probes that
// can go unanswered before dropping a connection.
// If zero, a default value of 9 is used.
Count int
}
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.