frpc: exit with code 1 if first login failed (#3740)

This commit is contained in:
fatedier 2023-11-01 17:06:55 +08:00 committed by GitHub
parent 5c4d820eb4
commit 5760c1cf92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 10 deletions

View File

@ -1,3 +1,3 @@
### Fixes
* `admin_user` is not effective in the INI configuration.
* frpc: Return code 1 when the first login attempt fails and exits.

View File

@ -83,8 +83,8 @@ func NewService(
pxyCfgs []v1.ProxyConfigurer,
visitorCfgs []v1.VisitorConfigurer,
cfgFile string,
) (svr *Service, err error) {
svr = &Service{
) *Service {
return &Service{
authSetter: auth.NewAuthSetter(cfg.Auth),
cfg: cfg,
cfgFile: cfgFile,
@ -93,7 +93,6 @@ func NewService(
ctx: context.Background(),
exit: 0,
}
return
}
func (svr *Service) GetController() *Control {

View File

@ -139,10 +139,7 @@ func startService(
log.Info("start frpc service for config file [%s]", cfgFile)
defer log.Info("frpc service for config file [%s] stopped", cfgFile)
}
svr, err := client.NewService(cfg, pxyCfgs, visitorCfgs, cfgFile)
if err != nil {
return err
}
svr := client.NewService(cfg, pxyCfgs, visitorCfgs, cfgFile)
shouldGracefulClose := cfg.Transport.Protocol == "kcp" || cfg.Transport.Protocol == "quic"
// Capture the exit signal if we use kcp or quic.
@ -150,6 +147,5 @@ func startService(
go handleTermSignal(svr)
}
_ = svr.Run(context.Background())
return nil
return svr.Run(context.Background())
}