Skip to content

Commit

Permalink
some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fatedier committed Apr 14, 2022
1 parent 6481870 commit 21240ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions client/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,13 @@ func (svr *Service) ReloadConf(pxyCfgs map[string]config.ProxyConf, visitorCfgs
svr.cfgMu.Unlock()

svr.ctlMu.RLock()
defer svr.ctlMu.RUnlock()
return svr.ctl.ReloadConf(pxyCfgs, visitorCfgs)
ctl := svr.ctl
svr.ctlMu.RUnlock()

if ctl != nil {
return svr.ctl.ReloadConf(pxyCfgs, visitorCfgs)
}
return nil
}

func (svr *Service) Close() {
Expand Down
1 change: 1 addition & 0 deletions cmd/frpc/sub/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ var rootCmd = &cobra.Command{
return nil
}
wg.Add(1)
time.Sleep(time.Millisecond)
go func() {
defer wg.Done()
err := runClient(path)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/vhost/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func NewHTTPReverseProxy(option HTTPReverseProxyOptions, vhostRouter *Routers) *
BufferPool: newWrapPool(),
ErrorLog: log.New(newWrapLogger(), "", 0),
ErrorHandler: func(rw http.ResponseWriter, req *http.Request, err error) {
frpLog.Warn("do http proxy request error: %v", err)
frpLog.Warn("do http proxy request [host: %s] error: %v", req.Host, err)
rw.WriteHeader(http.StatusNotFound)
rw.Write(getNotFoundPageContent())
},
Expand Down

0 comments on commit 21240ed

Please sign in to comment.