This commit is contained in:
crusader 2017-11-29 20:24:47 +09:00
parent ac4bd0e4ec
commit a711272d7f

View File

@ -1,13 +1,15 @@
package rpc package rpc
import ( import (
"fmt" "context"
"git.loafle.net/commons_go/logging"
"git.loafle.net/commons_go/rpc" "git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/gateway" "git.loafle.net/commons_go/rpc/gateway"
"git.loafle.net/commons_go/rpc/protocol" "git.loafle.net/commons_go/rpc/protocol"
"git.loafle.net/commons_go/rpc/protocol/json" "git.loafle.net/commons_go/rpc/protocol/json"
"git.loafle.net/overflow/overflow_gateway_web/grpc"
oogw "git.loafle.net/overflow/overflow_gateway_websocket"
"google.golang.org/grpc/metadata"
) )
func newGatewayRPCServletHandler() GatewayRPCServletHandler { func newGatewayRPCServletHandler() GatewayRPCServletHandler {
@ -21,20 +23,18 @@ type GatewayRPCServletHandlers struct {
} }
func (sh *GatewayRPCServletHandlers) Invoke(servletCTX rpc.ServletContext, requestCodec protocol.RegistryCodec) (result interface{}, err error) { func (sh *GatewayRPCServletHandlers) Invoke(servletCTX rpc.ServletContext, requestCodec protocol.RegistryCodec) (result interface{}, err error) {
// md := metadata.Pairs(oogw.GRPCUserIDKey, servletCTX.GetAttribute(oogw.SocketIDKey).(string)) md := metadata.Pairs(oogw.GRPCUserIDKey, servletCTX.GetAttribute(oogw.SocketIDKey).(string))
// grpcCTX := metadata.NewOutgoingContext(context.Background(), md) grpcCTX := metadata.NewOutgoingContext(context.Background(), md)
params, err := requestCodec.Params() params, err := requestCodec.Params()
if nil != err { if nil != err {
return nil, err return nil, err
} }
logging.Logger().Debug(fmt.Sprintf("method:%s, params:%v", requestCodec.Method(), params)) r, err := grpc.Exec(grpcCTX, requestCodec.Method(), params)
// r, err := grpc.Exec(grpcCTX, requestCodec.Method(), params) if err != nil {
// if err != nil { return nil, err
// return nil, err }
// }
r := "dfksdkdskf"
return r, nil return r, nil
} }