Compare commits

..
9 Commits
Author SHA1 Message Date
刘河 fbbd4bace2 http post large file bug 2019-02-27 13:02:34 +08:00
刘河 0492268190 Secret mode add bug 2019-02-25 20:25:23 +08:00
刘河 01fca7d568 nps test bug 2019-02-25 16:41:10 +08:00
刘河 0711b9befb Start link clean 2019-02-25 14:39:48 +08:00
刘河 2c13a02bdc conn limit bug 2019-02-25 13:55:10 +08:00
刘河 6788f24821 npc file load bug 2019-02-25 10:20:46 +08:00
刘河 e65ab33749 Clean bug 2019-02-24 16:51:54 +08:00
he liu 7f94b3871a Update client.go 2019-02-24 16:43:26 +08:00
he liu aa5b869da9 Update bridge.go 2019-02-24 16:42:53 +08:00
5 changed files with 20 additions and 11 deletions
+1 -1
View File
@@ -526,7 +526,7 @@ func (s *Bridge) linkCleanSession() {
}
v.Unlock()
}
s.clientLock.RUnlock()
s.clientLock.Unlock()
}
}
}
+1 -2
View File
@@ -13,7 +13,6 @@ import (
_ "github.com/cnlh/nps/web/routers"
"log"
"os"
"path/filepath"
)
@@ -24,6 +23,7 @@ var (
func main() {
flag.Parse()
beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf"))
if len(os.Args) > 1 {
switch os.Args[1] {
case "test":
@@ -37,7 +37,6 @@ func main() {
return
}
}
beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf"))
if level = beego.AppConfig.String("logLevel"); level == "" {
level = "7"
}
+1 -2
View File
@@ -53,7 +53,6 @@ func NewClient(vKey string, noStore bool, noDisplay bool) *Client {
Flow: new(Flow),
Rate: nil,
NoStore: noStore,
id: GetCsvDb().GetClientId(),
RWMutex: sync.RWMutex{},
NoDisplay: noDisplay,
}
@@ -81,8 +80,8 @@ func (s *Client) AddConn() {
}
func (s *Client) GetConn() bool {
s.CutConn()
if s.MaxConn == 0 || s.NowConn < s.MaxConn {
s.CutConn()
return true
}
return false
+16 -5
View File
@@ -174,12 +174,23 @@ func (s *httpServer) process(c *conn.Conn, r *http.Request) {
if err != nil {
break
}
host.Flow.Add(len(b), 0)
if _, err := tunnel.SendMsg(b, lk); err != nil {
c.Close()
break
l := len(b)
var start int
host.Flow.Add(l, 0)
for {
if l-start > 32*1024 {
_, err = tunnel.SendMsg(b[start:start+32*1024], lk)
start += 32 * 1024
<-lk.StatusCh
} else {
_, err = tunnel.SendMsg(b[start:l], lk)
<-lk.StatusCh
break
}
if err != nil {
break
}
}
<-lk.StatusCh
}
end:
if isConn {
+1 -1
View File
@@ -13,7 +13,7 @@ func init() {
}
func TestServerPort(p int, m string) (b bool) {
if p > 65535 || p <= 0 {
if p > 65535 || p < 0 {
return false
}
if len(ports) != 0 {