From e17aceb743d57224b17288661933c8b07619128c Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 14 Nov 2017 17:23:12 +0900 Subject: [PATCH] ing --- server/server.go | 21 +-------------------- server/server_handlers.go | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/server/server.go b/server/server.go index 344988a..c2c7660 100644 --- a/server/server.go +++ b/server/server.go @@ -1,30 +1,11 @@ package server import ( - "fmt" - - "git.loafle.net/commons_go/logging" cwf "git.loafle.net/commons_go/websocket_fasthttp" - "git.loafle.net/overflow/overflow_gateway_websocket/config" ) func New(sh ServerHandler) Server { - if nil == config.Config.Server { - logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized")) - } - - shs := sh.(*ServerHandlers) - - shs.Name = config.Config.Server.Name - shs.Concurrency = config.Config.Server.Concurrency - shs.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime - - 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) + s := cwf.New(sh) return s } diff --git a/server/server_handlers.go b/server/server_handlers.go index b849356..2caca1b 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -18,6 +18,25 @@ import ( "github.com/valyala/fasthttp" ) +func NewServerHandler() ServerHandler { + if nil == config.Config.Server { + logging.Logger().Panic(fmt.Sprintf("Gateway Websocket: Config of server is not initialized")) + } + + sh := &ServerHandlers{} + + sh.Name = config.Config.Server.Name + sh.Concurrency = config.Config.Server.Concurrency + sh.MaxStopWaitTime = config.Config.Server.MaxStopWaitTime + + sh.HandshakeTimeout = config.Config.Websocket.HandshakeTimeout + sh.ReadBufferSize = config.Config.Websocket.ReadBufferSize + sh.WriteBufferSize = config.Config.Websocket.WriteBufferSize + sh.EnableCompression = config.Config.Websocket.EnableCompression + + return sh +} + type ServerHandlers struct { cwf.ServerHandlers