修改读取数据的处理逻辑

This commit is contained in:
lwch
2021-08-24 15:35:08 +08:00
parent 0ebe103029
commit a8efb4e9c7
3 changed files with 1 additions and 7 deletions
-1
View File
@@ -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{}{}
}
-6
View File
@@ -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
+1
View File
@@ -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,