Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Feb 27, 2024
1 parent c7b8a8a commit 37c08d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions baseapp/msg_service_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type MessageRouter interface {
Handler(msg sdk.Msg) MsgServiceHandler
HandlerByTypeURL(typeURL string) MsgServiceHandler

ResponseNameByRequestName(msgName string) string
ResponseNameByRequestName(requestName string) string
HybridHandlerByMsgName(msgName string) func(ctx context.Context, req, resp protoiface.MessageV1) error
}

Expand Down Expand Up @@ -93,8 +93,8 @@ func (msr *MsgServiceRouter) HybridHandlerByMsgName(msgName string) func(ctx con
return msr.hybridHandlers[msgName]
}

func (msr *MsgServiceRouter) ResponseNameByRequestName(msgName string) string {
return msr.responseByRequest[msgName]
func (msr *MsgServiceRouter) ResponseNameByRequestName(requestName string) string {
return msr.responseByRequest[requestName]
}

func (msr *MsgServiceRouter) registerHybridHandler(sd *grpc.ServiceDesc, method grpc.MethodDesc, handler interface{}) error {
Expand Down
5 changes: 4 additions & 1 deletion runtime/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg protoiface.Mes
if typ == nil {
return nil, fmt.Errorf("no message type found for %s", respName)
}
msgResp := reflect.New(typ.Elem()).Interface().(protoiface.MessageV1)
msgResp, ok := reflect.New(typ.Elem()).Interface().(protoiface.MessageV1)
if !ok {
return nil, fmt.Errorf("could not create response message %s", respName)
}

handler := m.router.HybridHandlerByMsgName(messageName)
if handler == nil {
Expand Down

0 comments on commit 37c08d2

Please sign in to comment.