mirror of
https://github.com/fatedier/frp.git
synced 2024-11-24 02:59:19 +08:00
Merge pull request #882 from 235832289/master
Fix the problem of long connection for more than 30 seconds and disconnection of the server
This commit is contained in:
commit
6e305db4be
@ -61,6 +61,7 @@ var (
|
||||
allowPorts string
|
||||
maxPoolCount int64
|
||||
maxPortsPerClient int64
|
||||
vhostHttpTimeout int64
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -87,6 +88,7 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(&subDomainHost, "subdomain_host", "", "", "subdomain host")
|
||||
rootCmd.PersistentFlags().StringVarP(&allowPorts, "allow_ports", "", "", "allow ports")
|
||||
rootCmd.PersistentFlags().Int64VarP(&maxPortsPerClient, "max_ports_per_client", "", 0, "max ports per client")
|
||||
rootCmd.PersistentFlags().Int64VarP(&vhostHttpTimeout, "vhost_http_timeout", "", 30, "vhost http timeout")
|
||||
}
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
@ -191,6 +193,7 @@ func parseServerCommonCfgFromCmd() (err error) {
|
||||
}
|
||||
}
|
||||
g.GlbServerCfg.MaxPortsPerClient = maxPortsPerClient
|
||||
g.GlbServerCfg.VhostHttpTimeout = vhostHttpTimeout
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -66,3 +66,6 @@ subdomain_host = frps.com
|
||||
|
||||
# if tcp stream multiplexing is used, default is true
|
||||
tcp_mux = true
|
||||
|
||||
# if long connection for more than 30 seconds and disconnection of the server ,fix the pars .
|
||||
vhost_http_timeout = 30
|
@ -73,6 +73,7 @@ type ServerCommonConf struct {
|
||||
MaxPortsPerClient int64 `json:"max_ports_per_client"`
|
||||
HeartBeatTimeout int64 `json:"heart_beat_timeout"`
|
||||
UserConnTimeout int64 `json:"user_conn_timeout"`
|
||||
VhostHttpTimeout int64 `json:"vhost_http_timeout "`
|
||||
}
|
||||
|
||||
func GetDefaultServerConf() *ServerCommonConf {
|
||||
@ -102,6 +103,7 @@ func GetDefaultServerConf() *ServerCommonConf {
|
||||
MaxPortsPerClient: 0,
|
||||
HeartBeatTimeout: 90,
|
||||
UserConnTimeout: 10,
|
||||
VhostHttpTimeout: 30,
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,6 +302,15 @@ func UnmarshalServerConfFromIni(defaultCfg *ServerCommonConf, content string) (c
|
||||
cfg.HeartBeatTimeout = v
|
||||
}
|
||||
}
|
||||
if tmpStr, ok = conf.Get("common", "vhost_http_timeout"); ok {
|
||||
v, errRet := strconv.ParseInt(tmpStr, 10, 64)
|
||||
if errRet != nil {
|
||||
err = fmt.Errorf("Parse conf error: vhost_http_timeout is incorrect")
|
||||
return
|
||||
} else {
|
||||
cfg.VhostHttpTimeout = v
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/fatedier/frp/g"
|
||||
frpLog "github.com/fatedier/frp/utils/log"
|
||||
|
||||
"github.com/fatedier/golib/pool"
|
||||
)
|
||||
|
||||
var (
|
||||
responseHeaderTimeout = time.Duration(30) * time.Second
|
||||
responseHeaderTimeout = time.Duration(g.GlbServerCfg.VhostHttpTimeout) * time.Second
|
||||
|
||||
ErrRouterConfigConflict = errors.New("router config conflict")
|
||||
ErrNoDomain = errors.New("no such domain")
|
||||
|
Loading…
Reference in New Issue
Block a user