add max_delay_time parameter to frpc
This commit is contained in:
parent
0eecab06c1
commit
842e70e477
@ -168,7 +168,7 @@ func (svr *Service) Run() error {
|
|||||||
|
|
||||||
func (svr *Service) keepControllerWorking() {
|
func (svr *Service) keepControllerWorking() {
|
||||||
xl := xlog.FromContextSafe(svr.ctx)
|
xl := xlog.FromContextSafe(svr.ctx)
|
||||||
maxDelayTime := 20 * time.Second
|
maxDelayTime := time.Duration(svr.cfg.MaxDelayTime) * time.Second
|
||||||
delayTime := time.Second
|
delayTime := time.Second
|
||||||
|
|
||||||
// if frpc reconnect frps, we need to limit retry times in 1min
|
// if frpc reconnect frps, we need to limit retry times in 1min
|
||||||
|
@ -161,6 +161,8 @@ type ClientCommonConf struct {
|
|||||||
// Enable golang pprof handlers in admin listener.
|
// Enable golang pprof handlers in admin listener.
|
||||||
// Admin port must be set first.
|
// Admin port must be set first.
|
||||||
PprofEnable bool `ini:"pprof_enable" json:"pprof_enable"`
|
PprofEnable bool `ini:"pprof_enable" json:"pprof_enable"`
|
||||||
|
// MaxDelayTime specifies the maximum waiting time for frpc to reconnect frps.
|
||||||
|
MaxDelayTime int64 `ini:"max_delay_time" json:"max_delay_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDefaultClientConf returns a client configuration with default values.
|
// GetDefaultClientConf returns a client configuration with default values.
|
||||||
@ -191,6 +193,7 @@ func GetDefaultClientConf() ClientCommonConf {
|
|||||||
Metas: make(map[string]string),
|
Metas: make(map[string]string),
|
||||||
UDPPacketSize: 1500,
|
UDPPacketSize: 1500,
|
||||||
IncludeConfigFiles: make([]string, 0),
|
IncludeConfigFiles: make([]string, 0),
|
||||||
|
MaxDelayTime: 20,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +296,7 @@ func Test_LoadClientCommonConf(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UDPPacketSize: 1509,
|
UDPPacketSize: 1509,
|
||||||
IncludeConfigFiles: []string{},
|
IncludeConfigFiles: []string{},
|
||||||
|
MaxDelayTime: 60,
|
||||||
}
|
}
|
||||||
|
|
||||||
common, err := UnmarshalClientConfFromIni(testClientBytesWithFull)
|
common, err := UnmarshalClientConfFromIni(testClientBytesWithFull)
|
||||||
|
Loading…
Reference in New Issue
Block a user