This commit is contained in:
crusader 2018-04-13 15:37:27 +09:00
parent bfa9c10af7
commit 0588a0ffb5
4 changed files with 18 additions and 0 deletions

View File

@ -70,10 +70,15 @@ func (ch *ConnectionHandlers) Validate() error {
if ch.KeepAlive <= 0 {
ch.KeepAlive = DefaultKeepAlive
} else {
ch.KeepAlive = ch.KeepAlive * time.Second
}
if ch.HandshakeTimeout <= 0 {
ch.HandshakeTimeout = DefaultHandshakeTimeout
} else {
ch.HandshakeTimeout = ch.HandshakeTimeout * time.Second
}
return nil
}

View File

@ -78,9 +78,14 @@ func (rwh *ReadWriteHandlers) Validate() error {
}
if rwh.ReadTimeout <= 0 {
rwh.ReadTimeout = DefaultReadTimeout
} else {
rwh.ReadTimeout = rwh.ReadTimeout * time.Second
}
if rwh.WriteTimeout <= 0 {
rwh.WriteTimeout = DefaultWriteTimeout
} else {
rwh.WriteTimeout = rwh.WriteTimeout * time.Second
}
return nil

View File

@ -43,6 +43,8 @@ func (cch *ClientConnHandlers) Validate() error {
if cch.ReconnectInterval <= 0 {
cch.ReconnectInterval = server.DefaultReconnectInterval
} else {
cch.ReconnectInterval = cch.ReconnectInterval * time.Second
}
if cch.ReconnectTryTime <= 0 {

View File

@ -55,13 +55,19 @@ func (rwh *ReadWriteHandlers) Validate() error {
if rwh.PongTimeout <= 0 {
rwh.PongTimeout = server.DefaultPongTimeout
} else {
rwh.PongTimeout = rwh.PongTimeout * time.Second
}
if rwh.PingTimeout <= 0 {
rwh.PingTimeout = server.DefaultPingTimeout
} else {
rwh.PingTimeout = rwh.PingTimeout * time.Second
}
if rwh.PingPeriod <= 0 {
rwh.PingPeriod = (rwh.PingTimeout * 9) / 10
} else {
rwh.PingPeriod = rwh.PingPeriod * time.Second
}
return nil