From 7f9d88c10ab03522637769a4e1ba65233ed3e6ec Mon Sep 17 00:00:00 2001 From: fatedier Date: Mon, 8 Apr 2019 15:39:14 +0800 Subject: [PATCH] fix --- client/control.go | 7 +++++++ cmd/frpc/sub/root.go | 2 +- cmd/frps/root.go | 2 +- server/control.go | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/control.go b/client/control.go index 31f18f1..6a12b8c 100644 --- a/client/control.go +++ b/client/control.go @@ -148,6 +148,9 @@ func (ctl *Control) HandleNewProxyResp(inMsg *msg.NewProxyResp) { func (ctl *Control) Close() error { ctl.pm.Close() ctl.conn.Close() + if ctl.session != nil { + ctl.session.Close() + } return nil } @@ -202,6 +205,7 @@ func (ctl *Control) reader() { return } else { ctl.Warn("read error: %v", err) + ctl.conn.Close() return } } else { @@ -300,6 +304,9 @@ func (ctl *Control) worker() { ctl.vm.Close() close(ctl.closedDoneCh) + if ctl.session != nil { + ctl.session.Close() + } return } } diff --git a/cmd/frpc/sub/root.go b/cmd/frpc/sub/root.go index 00e3369..61d9b3d 100644 --- a/cmd/frpc/sub/root.go +++ b/cmd/frpc/sub/root.go @@ -73,7 +73,7 @@ var ( ) func init() { - rootCmd.PersistentFlags().StringVarP(&cfgFile, "", "c", "./frpc.ini", "config file of frpc") + rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "./frpc.ini", "config file of frpc") rootCmd.PersistentFlags().BoolVarP(&showVersion, "version", "v", false, "version of frpc") kcpDoneCh = make(chan struct{}) diff --git a/cmd/frps/root.go b/cmd/frps/root.go index cc7e0e1..e8def79 100644 --- a/cmd/frps/root.go +++ b/cmd/frps/root.go @@ -62,7 +62,7 @@ var ( ) func init() { - rootCmd.PersistentFlags().StringVarP(&cfgFile, "", "c", "", "config file of frps") + rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file of frps") rootCmd.PersistentFlags().BoolVarP(&showVersion, "version", "v", false, "version of frpc") rootCmd.PersistentFlags().StringVarP(&bindAddr, "bind_addr", "", "0.0.0.0", "bind address") diff --git a/server/control.go b/server/control.go index 169e173..8374ab2 100644 --- a/server/control.go +++ b/server/control.go @@ -301,6 +301,7 @@ func (ctl *Control) reader() { return } else { ctl.conn.Warn("read error: %v", err) + ctl.conn.Close() return } } else {