Skip to content

Commit

Permalink
Fix loginFailExit = false bug (#4354)
Browse files Browse the repository at this point in the history
* Fixed the issue that when loginFailExit = false, the frpc stop command cannot be stopped correctly if the server is not successfully connected after startup

* Update Release.md
  • Loading branch information
Yurunsoft committed Jul 30, 2024
1 parent 69cc422 commit e804519
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Features

* Added a new plugin `tls2raw`: Enables TLS termination and forwarding of decrypted raw traffic to local service.

* Fixed the issue that when `loginFailExit = false`, the frpc stop command cannot be stopped correctly if the server is not successfully connected after startup.
17 changes: 9 additions & 8 deletions client/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ func (svr *Service) Run(ctx context.Context) error {
netpkg.SetDefaultDNSAddress(svr.common.DNSServer)
}

if svr.webServer != nil {
go func() {
log.Infof("admin server listen on %s", svr.webServer.Address())
if err := svr.webServer.Run(); err != nil {
log.Warnf("admin server exit with error: %v", err)
}
}()
}

// first login to frps
svr.loopLoginUntilSuccess(10*time.Second, lo.FromPtr(svr.common.LoginFailExit))
if svr.ctl == nil {
Expand All @@ -179,14 +188,6 @@ func (svr *Service) Run(ctx context.Context) error {

go svr.keepControllerWorking()

if svr.webServer != nil {
go func() {
log.Infof("admin server listen on %s", svr.webServer.Address())
if err := svr.webServer.Run(); err != nil {
log.Warnf("admin server exit with error: %v", err)
}
}()
}
<-svr.ctx.Done()
svr.stop()
return nil
Expand Down

0 comments on commit e804519

Please sign in to comment.