mirror of
https://github.com/fatedier/frp.git
synced 2025-07-14 18:01:06 +07:00
client: add login_fail_exit params, default is true
if login_fail_exit is false, when frpc first login to server failed, it will continues relogin to server every 30 seconds.
This commit is contained in:
@ -106,9 +106,20 @@ func NewControl(svr *Service, pxyCfgs map[string]config.ProxyConf) *Control {
|
||||
// 7. In controler(): start new reader(), writer(), manager()
|
||||
// controler() will keep running
|
||||
func (ctl *Control) Run() error {
|
||||
err := ctl.login()
|
||||
if err != nil {
|
||||
return err
|
||||
for {
|
||||
err := ctl.login()
|
||||
if err != nil {
|
||||
// if login_fail_exit is true, just exit this program
|
||||
// otherwise sleep a while and continues relogin to server
|
||||
if config.ClientCommonCfg.LoginFailExit {
|
||||
return err
|
||||
} else {
|
||||
ctl.Warn("login to server fail: %v", err)
|
||||
time.Sleep(30 * time.Second)
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
go ctl.controler()
|
||||
|
Reference in New Issue
Block a user