mirror of https://github.com/fatedier/frp.git
models/msg: fix current connections statistics problem
This commit is contained in:
parent
e3bf7e2b2b
commit
ddd2acfe9f
|
@ -29,6 +29,7 @@ import (
|
||||||
"github.com/fatedier/frp/src/utils/pool"
|
"github.com/fatedier/frp/src/utils/pool"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// deprecated
|
||||||
// will block until connection close
|
// will block until connection close
|
||||||
func Join(c1 *conn.Conn, c2 *conn.Conn) {
|
func Join(c1 *conn.Conn, c2 *conn.Conn) {
|
||||||
var wait sync.WaitGroup
|
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)
|
pipeDecrypt(to, from, conf, needRecord)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if needRecord {
|
||||||
|
metric.OpenConnection(conf.Name)
|
||||||
|
}
|
||||||
wait.Add(2)
|
wait.Add(2)
|
||||||
go encryptPipe(c1, c2)
|
go encryptPipe(c1, c2)
|
||||||
go decryptPipe(c2, c1)
|
go decryptPipe(c2, c1)
|
||||||
|
|
|
@ -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(),
|
log.Debug("Join two connections, (l[%s] r[%s]) (l[%s] r[%s])", workConn.GetLocalAddr(), workConn.GetRemoteAddr(),
|
||||||
userConn.GetLocalAddr(), userConn.GetRemoteAddr())
|
userConn.GetLocalAddr(), userConn.GetRemoteAddr())
|
||||||
|
|
||||||
metric.OpenConnection(p.Name)
|
|
||||||
needRecord := true
|
needRecord := true
|
||||||
go msg.JoinMore(userConn, workConn, p.BaseConf, needRecord)
|
go msg.JoinMore(userConn, workConn, p.BaseConf, needRecord)
|
||||||
metric.OpenConnection(p.Name)
|
|
||||||
}(c)
|
}(c)
|
||||||
}
|
}
|
||||||
}(listener)
|
}(listener)
|
||||||
|
|
Loading…
Reference in New Issue