This commit is contained in:
crusader 2017-11-14 15:02:42 +09:00
parent 8c19c1a887
commit e5a491c6bb

View File

@ -8,21 +8,27 @@ import (
"git.loafle.net/overflow/overflow_gateway_websocket/config" "git.loafle.net/overflow/overflow_gateway_websocket/config"
) )
func New(sh ServerHandler) cwf.Server { func New(sh ServerHandler) Server {
if nil == config.Config.Server { if nil == config.Config.Server {
logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized")) logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized"))
} }
sh.Name = config.Config.Server.Name shs := sh.(*ServerHandlers)
sh.Concurrency = config.Config.Server.Concurrency
sh.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime
sh.HandshakeTimeout = config.Config.Websocket.HandshakeTimeout shs.Name = config.Config.Server.Name
sh.ReadBufferSize = config.Config.Websocket.ReadBufferSize shs.Concurrency = config.Config.Server.Concurrency
sh.WriteBufferSize = config.Config.Websocket.WriteBufferSize shs.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime
sh.EnableCompression = config.Config.Websocket.EnableCompression
s := cwf.New(sh) shs.HandshakeTimeout = config.Config.Websocket.HandshakeTimeout
shs.ReadBufferSize = config.Config.Websocket.ReadBufferSize
shs.WriteBufferSize = config.Config.Websocket.WriteBufferSize
shs.EnableCompression = config.Config.Websocket.EnableCompression
s := cwf.New(shs)
return s return s
} }
type Server interface {
cwf.Server
}