Browse Source

Exit bug、web display

刘河 6 years ago
parent
commit
45521d5680
4 changed files with 7 additions and 5 deletions
  1. 3 1
      client/control.go
  2. 2 2
      lib/file/db.go
  3. 1 1
      lib/version/version.go
  4. 1 1
      server/server.go

+ 3 - 1
client/control.go

@@ -211,6 +211,8 @@ func NewConn(tp string, vkey string, server string, connType string, proxyUrl st
 	if err != nil {
 		return nil, err
 	}
+	connection.SetDeadline(time.Now().Add(time.Second * 10))
+	defer connection.SetDeadline(time.Time{})
 	c := conn.NewConn(connection)
 	if _, err := c.Write([]byte(common.CONN_TEST)); err != nil {
 		return nil, err
@@ -220,7 +222,7 @@ func NewConn(tp string, vkey string, server string, connType string, proxyUrl st
 	}
 	if b, err := c.GetShortContent(32); err != nil || crypt.Md5(version.GetVersion()) != string(b) {
 		logs.Error("The client does not match the server version. The current version of the client is", version.GetVersion())
-		os.Exit(0)
+		return nil, err
 	}
 	if _, err := c.Write([]byte(common.Getverifyval(vkey))); err != nil {
 		return nil, err

+ 2 - 2
lib/file/db.go

@@ -64,7 +64,7 @@ func (s *DbUtils) GetClientList(start, length int, search, sort, order string, c
 			}
 			cnt++
 			if start--; start < 0 {
-				if length--; length > 0 {
+				if length--; length >= 0 {
 					list = append(list, v)
 				}
 			}
@@ -187,7 +187,7 @@ func (s *DbUtils) GetHost(start, length int, id int, search string) ([]*Host, in
 			if id == 0 || v.Client.Id == id {
 				cnt++
 				if start--; start < 0 {
-					if length--; length > 0 {
+					if length--; length >= 0 {
 						list = append(list, v)
 					}
 				}

+ 1 - 1
lib/version/version.go

@@ -1,6 +1,6 @@
 package version
 
-const VERSION = "0.22.4"
+const VERSION = "0.22.5"
 
 // Compulsory minimum version, Minimum downward compatibility to this version
 func GetVersion() string {

+ 1 - 1
server/server.go

@@ -242,7 +242,7 @@ func GetTunnel(start, length int, typeVal string, clientId int, search string) (
 				v.Client.IsConnect = false
 			}
 			if start--; start < 0 {
-				if length--; length > 0 {
+				if length--; length >= 0 {
 					if _, ok := RunList[v.Id]; ok {
 						v.RunStatus = true
 					} else {