From ddd2acfe9f24019bd400330c5adaf6508f619c49 Mon Sep 17 00:00:00 2001 From: fatedier Date: Fri, 12 Aug 2016 10:07:02 +0800 Subject: [PATCH] models/msg: fix current connections statistics problem --- src/models/msg/process.go | 4 ++++ src/models/server/server.go | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/models/msg/process.go b/src/models/msg/process.go index 342ddd2e..a1b84c23 100644 --- a/src/models/msg/process.go +++ b/src/models/msg/process.go @@ -29,6 +29,7 @@ import ( "github.com/fatedier/frp/src/utils/pool" ) +// deprecated // will block until connection close func Join(c1 *conn.Conn, c2 *conn.Conn) { var wait sync.WaitGroup @@ -72,6 +73,9 @@ func JoinMore(c1 *conn.Conn, c2 *conn.Conn, conf config.BaseConf, needRecord boo pipeDecrypt(to, from, conf, needRecord) } + if needRecord { + metric.OpenConnection(conf.Name) + } wait.Add(2) go encryptPipe(c1, c2) go decryptPipe(c2, c1) diff --git a/src/models/server/server.go b/src/models/server/server.go index 14e9fc86..d1502116 100644 --- a/src/models/server/server.go +++ b/src/models/server/server.go @@ -178,10 +178,8 @@ func (p *ProxyServer) Start(c *conn.Conn) (err error) { log.Debug("Join two connections, (l[%s] r[%s]) (l[%s] r[%s])", workConn.GetLocalAddr(), workConn.GetRemoteAddr(), userConn.GetLocalAddr(), userConn.GetRemoteAddr()) - metric.OpenConnection(p.Name) needRecord := true go msg.JoinMore(userConn, workConn, p.BaseConf, needRecord) - metric.OpenConnection(p.Name) }(c) } }(listener)