support protocol kcp

This commit is contained in:
fatedier
2017-06-04 19:56:21 +08:00
parent 74cf57feb3
commit 80ba931326
9 changed files with 202 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ type ClientCommonConf struct {
User string
LoginFailExit bool
Start map[string]struct{}
Protocol string
HeartBeatInterval int64
HeartBeatTimeout int64
}
@@ -61,6 +62,7 @@ func GetDeaultClientCommonConf() *ClientCommonConf {
User: "",
LoginFailExit: true,
Start: make(map[string]struct{}),
Protocol: "tcp",
HeartBeatInterval: 30,
HeartBeatTimeout: 90,
}
@@ -154,6 +156,15 @@ func LoadClientCommonConf(conf ini.File) (cfg *ClientCommonConf, err error) {
cfg.LoginFailExit = true
}
tmpStr, ok = conf.Get("common", "protocol")
if ok {
// Now it only support tcp and kcp.
if tmpStr != "kcp" {
tmpStr = "tcp"
}
cfg.Protocol = tmpStr
}
tmpStr, ok = conf.Get("common", "heartbeat_timeout")
if ok {
v, err = strconv.ParseInt(tmpStr, 10, 64)