Optimizing compatibility

This commit is contained in:
刘河
2019-03-30 16:35:43 +08:00
parent 2b841adb1b
commit 5bbf247863
9 changed files with 142 additions and 193 deletions

View File

@@ -215,8 +215,10 @@ reset:
}
if c.RateLimit == 0 {
c.Rate = rate.NewRate(int64(2 << 23))
c.Rate.Start()
} else if c.Rate == nil {
c.Rate = rate.NewRate(int64(c.RateLimit * 1024))
}
c.Rate.Start()
if !s.VerifyVkey(c.VerifyKey, c.Id) {
if isNotSet {
goto reset

View File

@@ -88,7 +88,7 @@ func (s *Client) GetConn() bool {
func (s *Client) HasTunnel(t *Tunnel) (exist bool) {
GetDb().JsonDb.Tasks.Range(func(key, value interface{}) bool {
v := value.(*Tunnel)
if v.Client.Id == s.Id && v.Port == t.Port {
if v.Client.Id == s.Id && v.Port == t.Port && t.Port != 0 {
exist = true
return false
}
@@ -152,8 +152,8 @@ type Host struct {
Location string //url router
Remark string //remark
Scheme string //http https all
CertFilePath string
KeyFilePath string
CertFilePath string
KeyFilePath string
NoStore bool
IsClose bool
Flow *Flow