add max_delay_time parameter to frpc

This commit is contained in:
suiahae 2023-01-28 21:09:23 +08:00
parent 0eecab06c1
commit 842e70e477
3 changed files with 5 additions and 1 deletions

View File

@ -168,7 +168,7 @@ func (svr *Service) Run() error {
func (svr *Service) keepControllerWorking() {
xl := xlog.FromContextSafe(svr.ctx)
maxDelayTime := 20 * time.Second
maxDelayTime := time.Duration(svr.cfg.MaxDelayTime) * time.Second
delayTime := time.Second
// if frpc reconnect frps, we need to limit retry times in 1min

View File

@ -161,6 +161,8 @@ type ClientCommonConf struct {
// Enable golang pprof handlers in admin listener.
// Admin port must be set first.
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.
@ -191,6 +193,7 @@ func GetDefaultClientConf() ClientCommonConf {
Metas: make(map[string]string),
UDPPacketSize: 1500,
IncludeConfigFiles: make([]string, 0),
MaxDelayTime: 20,
}
}

View File

@ -296,6 +296,7 @@ func Test_LoadClientCommonConf(t *testing.T) {
},
UDPPacketSize: 1509,
IncludeConfigFiles: []string{},
MaxDelayTime: 60,
}
common, err := UnmarshalClientConfFromIni(testClientBytesWithFull)