This commit is contained in:
crusader 2018-04-06 21:12:53 +09:00
parent 9a192c7015
commit f40ae6579b
2 changed files with 17 additions and 0 deletions

View File

@ -2,3 +2,4 @@ package: git.loafle.net/overflow/gateway_rest
import:
- package: github.com/valyala/fasthttp
version: ^20160617.0.0
- package: git.loafle.net/overflow/gateway

View File

@ -5,6 +5,7 @@ import (
"git.loafle.net/commons/server-go"
cswf "git.loafle.net/commons/server-go/web/fasthttp"
ogeg "git.loafle.net/overflow/gateway/external/grpc"
)
type ServerHandler interface {
@ -15,6 +16,15 @@ type ServerHandlers struct {
cswf.ServerHandlers
}
func (sh *ServerHandlers) Init(serverCtx server.ServerCtx) error {
if err := sh.ServerHandlers.Init(serverCtx); nil != err {
return nil
}
ogeg.InitPackage()
return nil
}
func (sh *ServerHandlers) Listener(serverCtx server.ServerCtx) (net.Listener, error) {
l, err := net.Listen("tcp", "192.168.1.101:44449")
if nil != err {
@ -23,3 +33,9 @@ func (sh *ServerHandlers) Listener(serverCtx server.ServerCtx) (net.Listener, er
return l, nil
}
func (sh *ServerHandlers) Destroy(serverCtx server.ServerCtx) {
ogeg.DestroyPackage()
sh.ServerHandlers.Destroy(serverCtx)
}