ing
This commit is contained in:
parent
4dbc9d8750
commit
e17aceb743
|
@ -1,30 +1,11 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"git.loafle.net/commons_go/logging"
|
|
||||||
cwf "git.loafle.net/commons_go/websocket_fasthttp"
|
cwf "git.loafle.net/commons_go/websocket_fasthttp"
|
||||||
"git.loafle.net/overflow/overflow_gateway_websocket/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(sh ServerHandler) Server {
|
func New(sh ServerHandler) Server {
|
||||||
if nil == config.Config.Server {
|
s := cwf.New(sh)
|
||||||
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)
|
|
||||||
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,25 @@ import (
|
||||||
"github.com/valyala/fasthttp"
|
"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 {
|
type ServerHandlers struct {
|
||||||
cwf.ServerHandlers
|
cwf.ServerHandlers
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user