mirror of
https://github.com/lwch/natpass.git
synced 2026-10-21 05:22:00 +00:00
修改读取数据的处理逻辑
This commit is contained in:
@@ -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{}{}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user