diff --git a/client/service.go b/client/service.go index eb59235..30bd3f8 100644 --- a/client/service.go +++ b/client/service.go @@ -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() { diff --git a/cmd/frpc/sub/root.go b/cmd/frpc/sub/root.go index 997733c..f8d7eb1 100644 --- a/cmd/frpc/sub/root.go +++ b/cmd/frpc/sub/root.go @@ -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) diff --git a/pkg/util/vhost/http.go b/pkg/util/vhost/http.go index b9dc32d..b720862 100644 --- a/pkg/util/vhost/http.go +++ b/pkg/util/vhost/http.go @@ -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()) },