mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-05 13:37:45 +03:00
chore: set default value of retry_interval to 1
the prior default value 0 would make hysteria retry very fast (2000 times / sec) when network is not ready (no default route). user can still set it to 0 explicitly for a "flood retry" mode.
This commit is contained in:
parent
a5647379b1
commit
29459d768d
2 changed files with 7 additions and 3 deletions
|
@ -152,11 +152,15 @@ func client(config *clientConfig) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithField("error", err).Error("Failed to initialize client")
|
logrus.WithField("error", err).Error("Failed to initialize client")
|
||||||
if try <= config.Retry || config.Retry < 0 {
|
if try <= config.Retry || config.Retry < 0 {
|
||||||
|
retryInterval := 1
|
||||||
|
if config.RetryInterval != nil {
|
||||||
|
retryInterval = *config.RetryInterval
|
||||||
|
}
|
||||||
logrus.WithFields(logrus.Fields{
|
logrus.WithFields(logrus.Fields{
|
||||||
"retry": try,
|
"retry": try,
|
||||||
"interval": config.RetryInterval,
|
"interval": retryInterval,
|
||||||
}).Info("Retrying...")
|
}).Info("Retrying...")
|
||||||
time.Sleep(time.Duration(config.RetryInterval) * time.Second)
|
time.Sleep(time.Duration(retryInterval) * time.Second)
|
||||||
} else {
|
} else {
|
||||||
logrus.Fatal("Out of retries, exiting...")
|
logrus.Fatal("Out of retries, exiting...")
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ type clientConfig struct {
|
||||||
DownMbps int `json:"down_mbps"`
|
DownMbps int `json:"down_mbps"`
|
||||||
// Optional below
|
// Optional below
|
||||||
Retry int `json:"retry"`
|
Retry int `json:"retry"`
|
||||||
RetryInterval int `json:"retry_interval"`
|
RetryInterval *int `json:"retry_interval"`
|
||||||
QuitOnDisconnect bool `json:"quit_on_disconnect"`
|
QuitOnDisconnect bool `json:"quit_on_disconnect"`
|
||||||
HandshakeTimeout int `json:"handshake_timeout"`
|
HandshakeTimeout int `json:"handshake_timeout"`
|
||||||
IdleTimeout int `json:"idle_timeout"`
|
IdleTimeout int `json:"idle_timeout"`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue