mirror of
https://github.com/fatedier/frp.git
synced 2025-07-27 07:35:07 +00:00
(1)新增心跳检测发送间隔和超时时间的配置
This commit is contained in:
@@ -11,16 +11,16 @@ import (
|
||||
|
||||
// common config
|
||||
var (
|
||||
BindAddr string = "0.0.0.0"
|
||||
BindPort int64 = 9527
|
||||
LogFile string = "./frps.log"
|
||||
LogLevel string = "warn"
|
||||
LogWay string = "file"
|
||||
BindAddr string = "0.0.0.0"
|
||||
BindPort int64 = 9527
|
||||
LogFile string = "./frps.log"
|
||||
LogLevel string = "warn"
|
||||
LogWay string = "file"
|
||||
HeartBeatTimeout int64 = 30
|
||||
)
|
||||
|
||||
var ProxyServers map[string]*models.ProxyServer = make(map[string]*models.ProxyServer)
|
||||
|
||||
|
||||
func LoadConf(confFile string) (err error) {
|
||||
var tmpStr string
|
||||
var ok bool
|
||||
|
@@ -151,7 +151,7 @@ func readControlMsgFromClient(server *models.ProxyServer, c *conn.Conn) {
|
||||
isContinueRead = false
|
||||
server.StopWaitUserConn()
|
||||
}
|
||||
timer := time.AfterFunc(10*time.Second, f)
|
||||
timer := time.AfterFunc(time.Duration(HeartBeatTimeout)*time.Second, f)
|
||||
defer timer.Stop()
|
||||
|
||||
for isContinueRead {
|
||||
@@ -169,7 +169,7 @@ func readControlMsgFromClient(server *models.ProxyServer, c *conn.Conn) {
|
||||
|
||||
if content == "\r\n" {
|
||||
log.Debug("receive hearbeat:%s", content)
|
||||
timer.Reset(10 * time.Second)
|
||||
timer.Reset(time.Duration(HeartBeatTimeout) * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user