From a8efb4e9c75c0c82bfd2dc62a206ef9d1336dd17 Mon Sep 17 00:00:00 2001 From: lwch Date: Tue, 24 Aug 2021 15:35:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BB=E5=8F=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/client/main.go | 1 - code/client/pool/pool.go | 6 ------ code/client/tunnel/link.go | 1 + 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/code/client/main.go b/code/client/main.go index 58e8b2b..d2ab98b 100644 --- a/code/client/main.go +++ b/code/client/main.go @@ -123,7 +123,6 @@ func connect(pool *pool.Pool, conn *pool.Conn, from, to string, req *network.Con }) lk := tunnel.NewLink(tn, req.GetId(), from, link, conn) conn.SendConnectOK(from, req.GetId()) - conn.AddLink(req.GetId()) lk.Forward() lk.OnWork <- struct{}{} } diff --git a/code/client/pool/pool.go b/code/client/pool/pool.go index 8423c7b..e18ce04 100644 --- a/code/client/pool/pool.go +++ b/code/client/pool/pool.go @@ -57,9 +57,6 @@ func (p *Pool) Get(id ...string) *Conn { conn := conns[p.idx%len(conns)] p.idx++ p.Unlock() - if len(id) > 0 { - conn.AddLink(id[0]) - } return conn } @@ -68,9 +65,6 @@ func (p *Pool) Get(id ...string) *Conn { return nil } c := newConn(p, conn) - if len(id) > 0 { - c.AddLink(id[0]) - } p.Lock() p.conns[c.ID] = c diff --git a/code/client/tunnel/link.go b/code/client/tunnel/link.go index a6a4e21..1118857 100644 --- a/code/client/tunnel/link.go +++ b/code/client/tunnel/link.go @@ -20,6 +20,7 @@ type Link struct { } func NewLink(parent *Tunnel, id, target string, local net.Conn, remote *pool.Conn) *Link { + remote.AddLink(id) logging.Info("new link: %s", id) return &Link{ parent: parent,