mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 03:16:53 +00:00
bug
This commit is contained in:
@@ -60,6 +60,7 @@ func (s *server) linkCopy(link *conn.Link, c *conn.Conn, rb []byte, tunnel *conn
|
||||
}
|
||||
flow.Add(n, 0)
|
||||
}
|
||||
<-link.StatusCh
|
||||
}
|
||||
pool.PutBufPoolCopy(buf)
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/cnlh/nps/lib/file"
|
||||
"github.com/cnlh/nps/lib/lg"
|
||||
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"path/filepath"
|
||||
@@ -137,9 +136,10 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
|
||||
}
|
||||
lk = conn.NewLink(host.Client.GetId(), common.CONN_TCP, host.GetRandomTarget(), host.Client.Cnf.CompressEncode, host.Client.Cnf.CompressDecode, host.Client.Cnf.Crypt, c, host.Flow, nil, host.Client.Rate, nil)
|
||||
if tunnel, err = s.bridge.SendLinkInfo(host.Client.Id, lk, c.Conn.RemoteAddr().String()); err != nil {
|
||||
log.Println(err)
|
||||
lg.Println(err)
|
||||
break
|
||||
}
|
||||
lk.Run(true)
|
||||
isConn = false
|
||||
} else {
|
||||
r, err = http.ReadRequest(bufio.NewReader(c))
|
||||
@@ -166,6 +166,7 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
|
||||
c.Close()
|
||||
break
|
||||
}
|
||||
<-lk.StatusCh
|
||||
}
|
||||
end:
|
||||
if isConn {
|
||||
@@ -173,9 +174,7 @@ end:
|
||||
} else {
|
||||
tunnel.SendMsg([]byte(common.IO_EOF), lk)
|
||||
}
|
||||
|
||||
c.Close()
|
||||
|
||||
}
|
||||
|
||||
func (s *httpServer) NewServer(port int) *http.Server {
|
||||
|
@@ -148,6 +148,7 @@ func (s *Sock5ModeServer) doConnect(c net.Conn, command uint8) {
|
||||
return
|
||||
} else {
|
||||
s.sendReply(c, succeeded)
|
||||
link.Run(true)
|
||||
s.linkCopy(link, conn.NewConn(c), nil, tunnel, s.task.Flow)
|
||||
}
|
||||
return
|
||||
|
@@ -57,6 +57,7 @@ func (s *TunnelModeServer) dealClient(c *conn.Conn, cnf *file.Config, addr strin
|
||||
c.Close()
|
||||
return err
|
||||
} else {
|
||||
link.Run(true)
|
||||
s.linkCopy(link, c, rb, tunnel, s.task.Flow)
|
||||
}
|
||||
return nil
|
||||
|
@@ -56,6 +56,7 @@ func (s *UdpModeServer) process(addr *net.UDPAddr, data []byte) {
|
||||
s.task.Flow.Add(len(data), 0)
|
||||
tunnel.SendMsg(data, link)
|
||||
pool.PutBufPoolUdp(data)
|
||||
link.Run(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user