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,