some improvements

This commit is contained in:
fatedier 2022-04-14 11:24:36 +08:00
parent 6481870d03
commit 21240ed962
3 changed files with 9 additions and 3 deletions

View File

@ -357,8 +357,13 @@ func (svr *Service) ReloadConf(pxyCfgs map[string]config.ProxyConf, visitorCfgs
svr.cfgMu.Unlock()
svr.ctlMu.RLock()
defer svr.ctlMu.RUnlock()
ctl := svr.ctl
svr.ctlMu.RUnlock()
if ctl != nil {
return svr.ctl.ReloadConf(pxyCfgs, visitorCfgs)
}
return nil
}
func (svr *Service) Close() {

View File

@ -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)

View File

@ -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())
},