Compare commits
9
Commits
V0.17.0beta
...
v0.15.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbbd4bace2 | ||
|
|
0492268190 | ||
|
|
01fca7d568 | ||
|
|
0711b9befb | ||
|
|
2c13a02bdc | ||
|
|
6788f24821 | ||
|
|
e65ab33749 | ||
|
|
7f94b3871a | ||
|
|
aa5b869da9 |
+1
-1
@@ -526,7 +526,7 @@ func (s *Bridge) linkCleanSession() {
|
||||
}
|
||||
v.Unlock()
|
||||
}
|
||||
s.clientLock.RUnlock()
|
||||
s.clientLock.Unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -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
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user